Diff
Modified: branches/safari-601-branch/LayoutTests/ChangeLog (196470 => 196471)
--- branches/safari-601-branch/LayoutTests/ChangeLog 2016-02-12 15:05:12 UTC (rev 196470)
+++ branches/safari-601-branch/LayoutTests/ChangeLog 2016-02-12 15:37:30 UTC (rev 196471)
@@ -1,3 +1,18 @@
+2016-02-12 Matthew Hanson <matthew_han...@apple.com>
+
+ Merge r196401. rdar://problem/24611749
+
+ 2016-02-10 Eric Carlson <eric.carl...@apple.com>
+
+ Update "manual" caption track logic
+ https://bugs.webkit.org/show_bug.cgi?id=154084
+ <rdar://problem/24530516>
+
+ Reviewed by Dean Jackson.
+
+ * media/track/track-manual-mode-expected.txt:
+ * media/track/track-manual-mode.html:
+
2016-02-03 Matthew Hanson <matthew_han...@apple.com>
Merge r196010. rdar://problem/24417428
Modified: branches/safari-601-branch/LayoutTests/media/track/track-manual-mode-expected.txt (196470 => 196471)
--- branches/safari-601-branch/LayoutTests/media/track/track-manual-mode-expected.txt 2016-02-12 15:05:12 UTC (rev 196470)
+++ branches/safari-601-branch/LayoutTests/media/track/track-manual-mode-expected.txt 2016-02-12 15:37:30 UTC (rev 196471)
@@ -6,19 +6,31 @@
RUN(internals.setCaptionDisplayMode('manual'))
EVENT(canplaythrough)
-** Forced tracks should be in .textTracks as well as in the menu,
-** but should be labeled as 'subtitles'
-
+** Forced tracks should be in .textTracks as well as in the menu
EXPECTED (video.textTracks.length == '9') OK
EXPECTED (trackMenuItems.length == '11') OK
+** 'forced' should be in the title of a forced track menu item
+Track menu:
+0: "Off", checked
+1: "Auto (Recommended)"
+2: "English Closed Captions CC"
+3: "English Subtitles"
+4: "English Subtitles Forced"
+5: "French Subtitles"
+6: "French Subtitles Forced"
+7: "German Subtitles"
+8: "German Subtitles Forced"
+9: "Spanish Subtitles"
+10: "Spanish Subtitles Forced"
+
** No track should be enabled by default
EXPECTED (video.textTracks[0].language == 'en') OK
EXPECTED (video.textTracks[0].kind == 'subtitles') OK
EXPECTED (video.textTracks[0].mode == 'disabled') OK
EXPECTED (video.textTracks[1].language == 'en') OK
-EXPECTED (video.textTracks[1].kind == 'subtitles') OK
+EXPECTED (video.textTracks[1].kind == 'forced') OK
EXPECTED (video.textTracks[1].mode == 'disabled') OK
EXPECTED (video.textTracks[2].language == 'fr') OK
@@ -26,7 +38,7 @@
EXPECTED (video.textTracks[2].mode == 'disabled') OK
EXPECTED (video.textTracks[3].language == 'fr') OK
-EXPECTED (video.textTracks[3].kind == 'subtitles') OK
+EXPECTED (video.textTracks[3].kind == 'forced') OK
EXPECTED (video.textTracks[3].mode == 'disabled') OK
EXPECTED (video.textTracks[4].language == 'es') OK
@@ -34,7 +46,7 @@
EXPECTED (video.textTracks[4].mode == 'disabled') OK
EXPECTED (video.textTracks[5].language == 'es') OK
-EXPECTED (video.textTracks[5].kind == 'subtitles') OK
+EXPECTED (video.textTracks[5].kind == 'forced') OK
EXPECTED (video.textTracks[5].mode == 'disabled') OK
EXPECTED (video.textTracks[6].language == 'de') OK
@@ -42,7 +54,7 @@
EXPECTED (video.textTracks[6].mode == 'disabled') OK
EXPECTED (video.textTracks[7].language == 'de') OK
-EXPECTED (video.textTracks[7].kind == 'subtitles') OK
+EXPECTED (video.textTracks[7].kind == 'forced') OK
EXPECTED (video.textTracks[7].mode == 'disabled') OK
EXPECTED (video.textTracks[8].language == 'en') OK
Modified: branches/safari-601-branch/LayoutTests/media/track/track-manual-mode.html (196470 => 196471)
--- branches/safari-601-branch/LayoutTests/media/track/track-manual-mode.html 2016-02-12 15:05:12 UTC (rev 196470)
+++ branches/safari-601-branch/LayoutTests/media/track/track-manual-mode.html 2016-02-12 15:37:30 UTC (rev 196471)
@@ -10,8 +10,7 @@
function testTracks()
{
- consoleWrite(`<br><i>** Forced tracks should be in .textTracks as well as in the menu,`);
- consoleWrite(`<i>** but should be labeled as 'subtitles'</i><br>`);
+ consoleWrite(`<br><i>** Forced tracks should be in .textTracks as well as in the menu`);
testExpected("video.textTracks.length", 9);
// Click the CC button to show the menu because it isn't created until it becomes visible.
@@ -24,6 +23,9 @@
}
testExpected("trackMenuItems.length", 11);
+ consoleWrite(`<br><i>** 'forced' should be in the title of a forced track menu item<i>`);
+ listTrackMenu();
+
consoleWrite("<br><i>** No track should be enabled by default<" + "/i>");
testExpected("video.textTracks[0].language", "en");
testExpected("video.textTracks[0].kind", "subtitles");
@@ -31,7 +33,7 @@
consoleWrite("");
testExpected("video.textTracks[1].language", "en");
- testExpected("video.textTracks[1].kind", "subtitles");
+ testExpected("video.textTracks[1].kind", "forced");
testExpected("video.textTracks[1].mode", "disabled");
consoleWrite("");
@@ -41,7 +43,7 @@
consoleWrite("");
testExpected("video.textTracks[3].language", "fr");
- testExpected("video.textTracks[3].kind", "subtitles");
+ testExpected("video.textTracks[3].kind", "forced");
testExpected("video.textTracks[3].mode", "disabled");
consoleWrite("");
@@ -51,7 +53,7 @@
consoleWrite("");
testExpected("video.textTracks[5].language", "es");
- testExpected("video.textTracks[5].kind", "subtitles");
+ testExpected("video.textTracks[5].kind", "forced");
testExpected("video.textTracks[5].mode", "disabled");
consoleWrite("");
@@ -61,7 +63,7 @@
consoleWrite("");
testExpected("video.textTracks[7].language", "de");
- testExpected("video.textTracks[7].kind", "subtitles");
+ testExpected("video.textTracks[7].kind", "forced");
testExpected("video.textTracks[7].mode", "disabled");
consoleWrite("");
Modified: branches/safari-601-branch/Source/WebCore/ChangeLog (196470 => 196471)
--- branches/safari-601-branch/Source/WebCore/ChangeLog 2016-02-12 15:05:12 UTC (rev 196470)
+++ branches/safari-601-branch/Source/WebCore/ChangeLog 2016-02-12 15:37:30 UTC (rev 196471)
@@ -1,3 +1,40 @@
+2016-02-12 Matthew Hanson <matthew_han...@apple.com>
+
+ Merge r196401. rdar://problem/24611749
+
+ 2016-02-10 Eric Carlson <eric.carl...@apple.com>
+
+ Update "manual" caption track logic
+ https://bugs.webkit.org/show_bug.cgi?id=154084
+ <rdar://problem/24530516>
+
+ Reviewed by Dean Jackson.
+
+ No new tests, media/track/track-manual-mode.html was updated.
+
+ * English.lproj/Localizable.strings: Add new string.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::addTextTrack): track.setManualSelectionMode is no more.
+ (WebCore::HTMLMediaElement::configureTextTrackGroup): Never enable a track automatically when
+ in manual selection mode.
+ (WebCore::HTMLMediaElement::captionPreferencesChanged): track.setManualSelectionMode is no more.
+
+ * html/track/TextTrack.cpp:
+ (WebCore::TextTrack::containsOnlyForcedSubtitles): Return true for forced tracks.
+ (WebCore::TextTrack::kind): Deleted.
+ * html/track/TextTrack.h:
+
+ * html/track/TrackBase.h:
+ (WebCore::TrackBase::kind): De-virtualize, nobody overrides it.
+
+ * page/CaptionUserPreferencesMediaAF.cpp:
+ (WebCore::trackDisplayName): Include "forced" in the name of forced tracks.
+
+ * platform/LocalizedStrings.cpp:
+ (WebCore::forcedTrackMenuItemText): New.
+ * platform/LocalizedStrings.h:
+
2016-02-10 Matthew Hanson <matthew_han...@apple.com>
Merge r196226. rdar://problem/24417430
Modified: branches/safari-601-branch/Source/WebCore/English.lproj/Localizable.strings (196470 => 196471)
--- branches/safari-601-branch/Source/WebCore/English.lproj/Localizable.strings 2016-02-12 15:05:12 UTC (rev 196470)
+++ branches/safari-601-branch/Source/WebCore/English.lproj/Localizable.strings 2016-02-12 15:37:30 UTC (rev 196471)
@@ -40,6 +40,9 @@
/* Text track contains simplified (3rd grade level) subtitles */
"%@ Easy Reader" = "%@ Easy Reader";
+/* Text track contains forced subtitles */
+"%@ Forced" = "%@ Forced";
+
/* visible name of the network process. The argument is the application name. */
"%@ Networking" = "%@ Networking";
Modified: branches/safari-601-branch/Source/WebCore/html/HTMLMediaElement.cpp (196470 => 196471)
--- branches/safari-601-branch/Source/WebCore/html/HTMLMediaElement.cpp 2016-02-12 15:05:12 UTC (rev 196470)
+++ branches/safari-601-branch/Source/WebCore/html/HTMLMediaElement.cpp 2016-02-12 15:37:30 UTC (rev 196471)
@@ -3521,7 +3521,6 @@
m_captionDisplayMode = page->group().captionPreferences()->captionDisplayMode();
}
- track->setManualSelectionMode(m_captionDisplayMode == CaptionUserPreferences::Manual);
textTracks()->append(track);
closeCaptionTracksChanged();
@@ -3784,30 +3783,32 @@
}
}
- if (!trackToEnable && defaultTrack)
- trackToEnable = defaultTrack;
-
- // If no track matches the user's preferred language, none was marked as 'default', and there is a forced subtitle track
- // in the same language as the language of the primary audio track, enable it.
- if (!trackToEnable && forcedSubitleTrack)
- trackToEnable = forcedSubitleTrack;
+ if (displayMode != CaptionUserPreferences::Manual) {
+ if (!trackToEnable && defaultTrack)
+ trackToEnable = defaultTrack;
- // If no track matches, don't disable an already visible track unless preferences say they all should be off.
- if (group.kind != TrackGroup::CaptionsAndSubtitles || displayMode != CaptionUserPreferences::ForcedOnly) {
- if (!trackToEnable && !defaultTrack && group.visibleTrack)
- trackToEnable = group.visibleTrack;
+ // If no track matches the user's preferred language, none was marked as 'default', and there is a forced subtitle track
+ // in the same language as the language of the primary audio track, enable it.
+ if (!trackToEnable && forcedSubitleTrack)
+ trackToEnable = forcedSubitleTrack;
+
+ // If no track matches, don't disable an already visible track unless preferences say they all should be off.
+ if (group.kind != TrackGroup::CaptionsAndSubtitles || displayMode != CaptionUserPreferences::ForcedOnly) {
+ if (!trackToEnable && !defaultTrack && group.visibleTrack)
+ trackToEnable = group.visibleTrack;
+ }
+
+ // If no track matches the user's preferred language and non was marked 'default', enable the first track
+ // because the user has explicitly stated a preference for this kind of track.
+ if (!trackToEnable && fallbackTrack)
+ trackToEnable = fallbackTrack;
+
+ if (trackToEnable)
+ m_subtitleTrackLanguage = trackToEnable->language();
+ else
+ m_subtitleTrackLanguage = emptyString();
}
-
- // If no track matches the user's preferred language and non was marked 'default', enable the first track
- // because the user has explicitly stated a preference for this kind of track.
- if (!trackToEnable && fallbackTrack)
- trackToEnable = fallbackTrack;
- if (trackToEnable)
- m_subtitleTrackLanguage = trackToEnable->language();
- else
- m_subtitleTrackLanguage = emptyString();
-
if (currentlyEnabledTracks.size()) {
for (size_t i = 0; i < currentlyEnabledTracks.size(); ++i) {
RefPtr<TextTrack> textTrack = currentlyEnabledTracks[i];
@@ -5634,11 +5635,6 @@
if (m_captionDisplayMode == displayMode)
return;
- if (m_captionDisplayMode == CaptionUserPreferences::Manual || displayMode == CaptionUserPreferences::Manual) {
- for (unsigned i = 0; i < m_textTracks->length(); ++i)
- m_textTracks->item(i)->setManualSelectionMode(displayMode == CaptionUserPreferences::Manual);
- }
-
m_captionDisplayMode = displayMode;
setWebkitClosedCaptionsVisible(m_captionDisplayMode == CaptionUserPreferences::AlwaysOn);
}
Modified: branches/safari-601-branch/Source/WebCore/html/track/TextTrack.cpp (196470 => 196471)
--- branches/safari-601-branch/Source/WebCore/html/track/TextTrack.cpp 2016-02-12 15:05:12 UTC (rev 196470)
+++ branches/safari-601-branch/Source/WebCore/html/track/TextTrack.cpp 2016-02-12 15:37:30 UTC (rev 196471)
@@ -177,15 +177,6 @@
return false;
}
-AtomicString TextTrack::kind() const
-{
- AtomicString kind = TrackBase::kind();
- if (!m_manualSelectionMode || kind != forcedKeyword())
- return kind;
-
- return subtitlesKeyword();
-}
-
void TextTrack::setKind(const AtomicString& newKind)
{
String oldKind = kind();
@@ -602,6 +593,11 @@
return kind() == captionsKeyword();
}
+bool TextTrack::containsOnlyForcedSubtitles() const
+{
+ return kind() == forcedKeyword();
+}
+
#if ENABLE(MEDIA_SOURCE)
void TextTrack::setLanguage(const AtomicString& language)
{
Modified: branches/safari-601-branch/Source/WebCore/html/track/TextTrack.h (196470 => 196471)
--- branches/safari-601-branch/Source/WebCore/html/track/TextTrack.h 2016-02-12 15:05:12 UTC (rev 196470)
+++ branches/safari-601-branch/Source/WebCore/html/track/TextTrack.h 2016-02-12 15:37:30 UTC (rev 196471)
@@ -92,8 +92,7 @@
static const AtomicString& hiddenKeyword();
static const AtomicString& showingKeyword();
- void setKind(const AtomicString&) override;
- AtomicString kind() const override;
+ virtual void setKind(const AtomicString&) override;
virtual AtomicString inBandMetadataTrackDispatchType() const { return emptyString(); }
@@ -129,7 +128,7 @@
virtual bool isClosedCaptions() const { return false; }
virtual bool isSDH() const { return false; }
- virtual bool containsOnlyForcedSubtitles() const { return false; }
+ virtual bool containsOnlyForcedSubtitles() const;
virtual bool isMainProgramContent() const;
virtual bool isEasyToRead() const { return false; }
@@ -159,8 +158,6 @@
virtual MediaTime startTimeVariance() const { return MediaTime::zeroTime(); }
- void setManualSelectionMode(bool mode) { m_manualSelectionMode = mode; }
-
using RefCounted<TrackBase>::ref;
using RefCounted<TrackBase>::deref;
@@ -198,7 +195,6 @@
int m_trackIndex;
int m_renderedTrackIndex;
bool m_hasBeenConfigured;
- bool m_manualSelectionMode { false };
};
inline TextTrack* toTextTrack(TrackBase* track)
Modified: branches/safari-601-branch/Source/WebCore/html/track/TrackBase.h (196470 => 196471)
--- branches/safari-601-branch/Source/WebCore/html/track/TrackBase.h 2016-02-12 15:05:12 UTC (rev 196470)
+++ branches/safari-601-branch/Source/WebCore/html/track/TrackBase.h 2016-02-12 15:37:30 UTC (rev 196471)
@@ -51,7 +51,7 @@
virtual AtomicString id() const { return m_id; }
virtual void setId(const AtomicString& id) { m_id = id; }
- virtual AtomicString kind() const { return m_kind; }
+ AtomicString kind() const { return m_kind; }
virtual void setKind(const AtomicString&);
AtomicString label() const { return m_label; }
Modified: branches/safari-601-branch/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp (196470 => 196471)
--- branches/safari-601-branch/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp 2016-02-12 15:05:12 UTC (rev 196470)
+++ branches/safari-601-branch/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp 2016-02-12 15:37:30 UTC (rev 196471)
@@ -666,22 +666,32 @@
if (track == TextTrack::captionMenuAutomaticItem())
return textTrackAutomaticMenuItemText();
- StringBuilder displayName;
- buildDisplayStringForTrackBase(displayName, *track);
+ StringBuilder displayNameBuilder;
+ buildDisplayStringForTrackBase(displayNameBuilder, *track);
- if (displayName.isEmpty())
- displayName.append(textTrackNoLabelText());
-
- if (track->isEasyToRead())
- return easyReaderTrackMenuItemText(displayName.toString());
-
- if (track->isClosedCaptions())
- return closedCaptionTrackMenuItemText(displayName.toString());
+ if (displayNameBuilder.isEmpty())
+ displayNameBuilder.append(textTrackNoLabelText());
+ String displayName = displayNameBuilder.toString();
+
+ if (track->isClosedCaptions()) {
+ displayName = closedCaptionTrackMenuItemText(displayName);
+ if (track->isEasyToRead())
+ displayName = easyReaderTrackMenuItemText(displayName);
+
+ return displayName;
+ }
+
if (track->isSDH())
- return sdhTrackMenuItemText(displayName.toString());
+ displayName = sdhTrackMenuItemText(displayName);
- return displayName.toString();
+ if (track->containsOnlyForcedSubtitles())
+ displayName = forcedTrackMenuItemText(displayName);
+
+ if (track->isEasyToRead())
+ displayName = easyReaderTrackMenuItemText(displayName);
+
+ return displayName;
}
String CaptionUserPreferencesMediaAF::displayNameForTrack(TextTrack* track) const
Modified: branches/safari-601-branch/Source/WebCore/platform/LocalizedStrings.cpp (196470 => 196471)
--- branches/safari-601-branch/Source/WebCore/platform/LocalizedStrings.cpp 2016-02-12 15:05:12 UTC (rev 196470)
+++ branches/safari-601-branch/Source/WebCore/platform/LocalizedStrings.cpp 2016-02-12 15:37:30 UTC (rev 196471)
@@ -1110,6 +1110,11 @@
{
return formatLocalizedString(WEB_UI_STRING("%@ Easy Reader", "Text track contains simplified (3rd grade level) subtitles"), title.createCFString().get());
}
+
+String forcedTrackMenuItemText(const String& title)
+{
+ return formatLocalizedString(WEB_UI_STRING("%@ Forced", "Text track contains forced subtitles"), title.createCFString().get());
+}
#endif
#endif
Modified: branches/safari-601-branch/Source/WebCore/platform/LocalizedStrings.h (196470 => 196471)
--- branches/safari-601-branch/Source/WebCore/platform/LocalizedStrings.h 2016-02-12 15:05:12 UTC (rev 196470)
+++ branches/safari-601-branch/Source/WebCore/platform/LocalizedStrings.h 2016-02-12 15:37:30 UTC (rev 196471)
@@ -257,6 +257,7 @@
String closedCaptionTrackMenuItemText(const String&);
String sdhTrackMenuItemText(const String&);
String easyReaderTrackMenuItemText(const String&);
+ String forcedTrackMenuItemText(const String&);
#endif
#endif