Changeset 196401 in webkit
- Timestamp:
- Feb 10, 2016 4:10:52 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r196398 r196401 1 2016-02-10 Eric Carlson <eric.carlson@apple.com> 2 3 Update "manual" caption track logic 4 https://bugs.webkit.org/show_bug.cgi?id=154084 5 <rdar://problem/24530516> 6 7 Reviewed by Dean Jackson. 8 9 * media/track/track-manual-mode-expected.txt: 10 * media/track/track-manual-mode.html: 11 1 12 2016-02-10 Ryan Haddad <ryanhaddad@apple.com> 2 13 -
trunk/LayoutTests/media/track/track-manual-mode-expected.txt
r196010 r196401 7 7 EVENT(canplaythrough) 8 8 9 ** Forced tracks should be in .textTracks as well as in the menu, 10 ** but should be labeled as 'subtitles' 11 9 ** Forced tracks should be in .textTracks as well as in the menu 12 10 EXPECTED (video.textTracks.length == '9') OK 13 11 EXPECTED (trackMenuItems.length == '11') OK 12 13 ** 'forced' should be in the title of a forced track menu item 14 Track menu: 15 0: "Off", checked 16 1: "Auto (Recommended)" 17 2: "English Closed Captions CC" 18 3: "English Subtitles" 19 4: "English Subtitles Forced" 20 5: "French Subtitles" 21 6: "French Subtitles Forced" 22 7: "German Subtitles" 23 8: "German Subtitles Forced" 24 9: "Spanish Subtitles" 25 10: "Spanish Subtitles Forced" 14 26 15 27 ** No track should be enabled by default … … 19 31 20 32 EXPECTED (video.textTracks[1].language == 'en') OK 21 EXPECTED (video.textTracks[1].kind == ' subtitles') OK33 EXPECTED (video.textTracks[1].kind == 'forced') OK 22 34 EXPECTED (video.textTracks[1].mode == 'disabled') OK 23 35 … … 27 39 28 40 EXPECTED (video.textTracks[3].language == 'fr') OK 29 EXPECTED (video.textTracks[3].kind == ' subtitles') OK41 EXPECTED (video.textTracks[3].kind == 'forced') OK 30 42 EXPECTED (video.textTracks[3].mode == 'disabled') OK 31 43 … … 35 47 36 48 EXPECTED (video.textTracks[5].language == 'es') OK 37 EXPECTED (video.textTracks[5].kind == ' subtitles') OK49 EXPECTED (video.textTracks[5].kind == 'forced') OK 38 50 EXPECTED (video.textTracks[5].mode == 'disabled') OK 39 51 … … 43 55 44 56 EXPECTED (video.textTracks[7].language == 'de') OK 45 EXPECTED (video.textTracks[7].kind == ' subtitles') OK57 EXPECTED (video.textTracks[7].kind == 'forced') OK 46 58 EXPECTED (video.textTracks[7].mode == 'disabled') OK 47 59 -
trunk/LayoutTests/media/track/track-manual-mode.html
r196010 r196401 11 11 function testTracks() 12 12 { 13 consoleWrite(`<br><i>** Forced tracks should be in .textTracks as well as in the menu,`); 14 consoleWrite(`<i>** but should be labeled as 'subtitles'</i><br>`); 13 consoleWrite(`<br><i>** Forced tracks should be in .textTracks as well as in the menu`); 15 14 testExpected("video.textTracks.length", 9); 16 15 … … 25 24 testExpected("trackMenuItems.length", 11); 26 25 26 consoleWrite(`<br><i>** 'forced' should be in the title of a forced track menu item<i>`); 27 listTrackMenu(); 28 27 29 consoleWrite("<br><i>** No track should be enabled by default<" + "/i>"); 28 30 testExpected("video.textTracks[0].language", "en"); … … 32 34 33 35 testExpected("video.textTracks[1].language", "en"); 34 testExpected("video.textTracks[1].kind", " subtitles");36 testExpected("video.textTracks[1].kind", "forced"); 35 37 testExpected("video.textTracks[1].mode", "disabled"); 36 38 consoleWrite(""); … … 42 44 43 45 testExpected("video.textTracks[3].language", "fr"); 44 testExpected("video.textTracks[3].kind", " subtitles");46 testExpected("video.textTracks[3].kind", "forced"); 45 47 testExpected("video.textTracks[3].mode", "disabled"); 46 48 consoleWrite(""); … … 52 54 53 55 testExpected("video.textTracks[5].language", "es"); 54 testExpected("video.textTracks[5].kind", " subtitles");56 testExpected("video.textTracks[5].kind", "forced"); 55 57 testExpected("video.textTracks[5].mode", "disabled"); 56 58 consoleWrite(""); … … 62 64 63 65 testExpected("video.textTracks[7].language", "de"); 64 testExpected("video.textTracks[7].kind", " subtitles");66 testExpected("video.textTracks[7].kind", "forced"); 65 67 testExpected("video.textTracks[7].mode", "disabled"); 66 68 consoleWrite(""); -
trunk/Source/WebCore/ChangeLog
r196400 r196401 1 2016-02-10 Eric Carlson <eric.carlson@apple.com> 2 3 Update "manual" caption track logic 4 https://bugs.webkit.org/show_bug.cgi?id=154084 5 <rdar://problem/24530516> 6 7 Reviewed by Dean Jackson. 8 9 No new tests, media/track/track-manual-mode.html was updated. 10 11 * English.lproj/Localizable.strings: Add new string. 12 13 * html/HTMLMediaElement.cpp: 14 (WebCore::HTMLMediaElement::addTextTrack): track.setManualSelectionMode is no more. 15 (WebCore::HTMLMediaElement::configureTextTrackGroup): Never enable a track automatically when 16 in manual selection mode. 17 (WebCore::HTMLMediaElement::captionPreferencesChanged): track.setManualSelectionMode is no more. 18 19 * html/track/TextTrack.cpp: 20 (WebCore::TextTrack::containsOnlyForcedSubtitles): Return true for forced tracks. 21 (WebCore::TextTrack::kind): Deleted. 22 * html/track/TextTrack.h: 23 24 * html/track/TrackBase.h: 25 (WebCore::TrackBase::kind): De-virtualize, nobody overrides it. 26 27 * page/CaptionUserPreferencesMediaAF.cpp: 28 (WebCore::trackDisplayName): Include "forced" in the name of forced tracks. 29 30 * platform/LocalizedStrings.cpp: 31 (WebCore::forcedTrackMenuItemText): New. 32 * platform/LocalizedStrings.h: 33 1 34 2016-02-10 Jiewen Tan <jiewen_tan@apple.com> 2 35 -
trunk/Source/WebCore/English.lproj/Localizable.strings
r195971 r196401 41 41 "%@ Easy Reader" = "%@ Easy Reader"; 42 42 43 /* Text track contains forced subtitles */ 44 "%@ Forced" = "%@ Forced"; 45 43 46 /* visible name of the network process. The argument is the application name. */ 44 47 "%@ Networking" = "%@ Networking"; -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r196400 r196401 3551 3551 } 3552 3552 3553 track->setManualSelectionMode(m_captionDisplayMode == CaptionUserPreferences::Manual);3554 3553 textTracks()->append(track); 3555 3554 … … 3814 3813 } 3815 3814 3816 if (!trackToEnable && defaultTrack) 3817 trackToEnable = defaultTrack; 3818 3819 // If no track matches the user's preferred language, none was marked as 'default', and there is a forced subtitle track 3820 // in the same language as the language of the primary audio track, enable it. 3821 if (!trackToEnable && forcedSubitleTrack) 3822 trackToEnable = forcedSubitleTrack; 3823 3824 // If no track matches, don't disable an already visible track unless preferences say they all should be off. 3825 if (group.kind != TrackGroup::CaptionsAndSubtitles || displayMode != CaptionUserPreferences::ForcedOnly) { 3826 if (!trackToEnable && !defaultTrack && group.visibleTrack) 3827 trackToEnable = group.visibleTrack; 3828 } 3829 3830 // If no track matches the user's preferred language and non was marked 'default', enable the first track 3831 // because the user has explicitly stated a preference for this kind of track. 3832 if (!trackToEnable && fallbackTrack) 3833 trackToEnable = fallbackTrack; 3834 3835 if (trackToEnable) 3836 m_subtitleTrackLanguage = trackToEnable->language(); 3837 else 3838 m_subtitleTrackLanguage = emptyString(); 3839 3815 if (displayMode != CaptionUserPreferences::Manual) { 3816 if (!trackToEnable && defaultTrack) 3817 trackToEnable = defaultTrack; 3818 3819 // If no track matches the user's preferred language, none was marked as 'default', and there is a forced subtitle track 3820 // in the same language as the language of the primary audio track, enable it. 3821 if (!trackToEnable && forcedSubitleTrack) 3822 trackToEnable = forcedSubitleTrack; 3823 3824 // If no track matches, don't disable an already visible track unless preferences say they all should be off. 3825 if (group.kind != TrackGroup::CaptionsAndSubtitles || displayMode != CaptionUserPreferences::ForcedOnly) { 3826 if (!trackToEnable && !defaultTrack && group.visibleTrack) 3827 trackToEnable = group.visibleTrack; 3828 } 3829 3830 // If no track matches the user's preferred language and non was marked 'default', enable the first track 3831 // because the user has explicitly stated a preference for this kind of track. 3832 if (!trackToEnable && fallbackTrack) 3833 trackToEnable = fallbackTrack; 3834 3835 if (trackToEnable) 3836 m_subtitleTrackLanguage = trackToEnable->language(); 3837 else 3838 m_subtitleTrackLanguage = emptyString(); 3839 } 3840 3840 3841 if (currentlyEnabledTracks.size()) { 3841 3842 for (size_t i = 0; i < currentlyEnabledTracks.size(); ++i) { … … 5696 5697 return; 5697 5698 5698 if (m_captionDisplayMode == CaptionUserPreferences::Manual || displayMode == CaptionUserPreferences::Manual) {5699 for (unsigned i = 0; i < m_textTracks->length(); ++i)5700 m_textTracks->item(i)->setManualSelectionMode(displayMode == CaptionUserPreferences::Manual);5701 }5702 5703 5699 m_captionDisplayMode = displayMode; 5704 5700 setWebkitClosedCaptionsVisible(m_captionDisplayMode == CaptionUserPreferences::AlwaysOn); -
trunk/Source/WebCore/html/track/TextTrack.cpp
r196010 r196401 174 174 } 175 175 176 AtomicString TextTrack::kind() const177 {178 AtomicString kind = TrackBase::kind();179 if (!m_manualSelectionMode || kind != forcedKeyword())180 return kind;181 182 return subtitlesKeyword();183 }184 185 176 void TextTrack::setKind(const AtomicString& newKind) 186 177 { … … 555 546 } 556 547 548 bool TextTrack::containsOnlyForcedSubtitles() const 549 { 550 return kind() == forcedKeyword(); 551 } 552 557 553 #if ENABLE(MEDIA_SOURCE) 558 554 void TextTrack::setLanguage(const AtomicString& language) -
trunk/Source/WebCore/html/track/TextTrack.h
r196010 r196401 83 83 static const AtomicString& showingKeyword(); 84 84 85 void setKind(const AtomicString&) override; 86 AtomicString kind() const override; 85 virtual void setKind(const AtomicString&) override; 87 86 88 87 virtual AtomicString inBandMetadataTrackDispatchType() const { return emptyString(); } … … 118 117 virtual bool isClosedCaptions() const { return false; } 119 118 virtual bool isSDH() const { return false; } 120 virtual bool containsOnlyForcedSubtitles() const { return false; }119 virtual bool containsOnlyForcedSubtitles() const; 121 120 virtual bool isMainProgramContent() const; 122 121 virtual bool isEasyToRead() const { return false; } … … 143 142 144 143 virtual MediaTime startTimeVariance() const { return MediaTime::zeroTime(); } 145 146 void setManualSelectionMode(bool mode) { m_manualSelectionMode = mode; }147 144 148 145 using RefCounted<TrackBase>::ref; … … 175 172 int m_renderedTrackIndex; 176 173 bool m_hasBeenConfigured; 177 bool m_manualSelectionMode { false };178 174 }; 179 175 -
trunk/Source/WebCore/html/track/TrackBase.h
r196010 r196401 52 52 virtual void setId(const AtomicString& id) { m_id = id; } 53 53 54 virtualAtomicString kind() const { return m_kind; }54 AtomicString kind() const { return m_kind; } 55 55 virtual void setKind(const AtomicString&); 56 56 -
trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp
r196080 r196401 668 668 return textTrackAutomaticMenuItemText(); 669 669 670 StringBuilder displayName; 671 buildDisplayStringForTrackBase(displayName, *track); 672 673 if (displayName.isEmpty()) 674 displayName.append(textTrackNoLabelText()); 675 670 StringBuilder displayNameBuilder; 671 buildDisplayStringForTrackBase(displayNameBuilder, *track); 672 673 if (displayNameBuilder.isEmpty()) 674 displayNameBuilder.append(textTrackNoLabelText()); 675 676 String displayName = displayNameBuilder.toString(); 677 678 if (track->isClosedCaptions()) { 679 displayName = closedCaptionTrackMenuItemText(displayName); 680 if (track->isEasyToRead()) 681 displayName = easyReaderTrackMenuItemText(displayName); 682 683 return displayName; 684 } 685 686 if (track->isSDH()) 687 displayName = sdhTrackMenuItemText(displayName); 688 689 if (track->containsOnlyForcedSubtitles()) 690 displayName = forcedTrackMenuItemText(displayName); 691 676 692 if (track->isEasyToRead()) 677 return easyReaderTrackMenuItemText(displayName.toString()); 678 679 if (track->isClosedCaptions()) 680 return closedCaptionTrackMenuItemText(displayName.toString()); 681 682 if (track->isSDH()) 683 return sdhTrackMenuItemText(displayName.toString()); 684 685 return displayName.toString(); 693 displayName = easyReaderTrackMenuItemText(displayName); 694 695 return displayName; 686 696 } 687 697 -
trunk/Source/WebCore/platform/LocalizedStrings.cpp
r194819 r196401 1112 1112 return formatLocalizedString(WEB_UI_STRING("%@ Easy Reader", "Text track contains simplified (3rd grade level) subtitles"), title.createCFString().get()); 1113 1113 } 1114 1115 String forcedTrackMenuItemText(const String& title) 1116 { 1117 return formatLocalizedString(WEB_UI_STRING("%@ Forced", "Text track contains forced subtitles"), title.createCFString().get()); 1118 } 1114 1119 #endif 1115 1120 -
trunk/Source/WebCore/platform/LocalizedStrings.h
r186012 r196401 258 258 String sdhTrackMenuItemText(const String&); 259 259 String easyReaderTrackMenuItemText(const String&); 260 String forcedTrackMenuItemText(const String&); 260 261 #endif 261 262 #endif
Note: See TracChangeset
for help on using the changeset viewer.