Diff
Modified: branches/safari-537-branch/LayoutTests/ChangeLog (152505 => 152506)
--- branches/safari-537-branch/LayoutTests/ChangeLog 2013-07-09 18:21:30 UTC (rev 152505)
+++ branches/safari-537-branch/LayoutTests/ChangeLog 2013-07-09 18:27:04 UTC (rev 152506)
@@ -1,3 +1,17 @@
+2013-07-09 Lucas Forschler <[email protected]>
+
+ Merge r152422
+
+ 2013-07-05 Eric Carlson <[email protected]>
+
+ [Mac] .webkitClosedCaptionsVisible doesn't work with "Automatic" caption mode
+ https://bugs.webkit.org/show_bug.cgi?id=118319
+
+ Reviewed by Jer Noble.
+
+ * media/track/track-legacyapi-with-automatic-mode-expected.txt: Added.
+ * media/track/track-legacyapi-with-automatic-mode.html: Added.
+
2013-07-08 Alexey Proskuryakov <[email protected]>
Updating fast/js/global-constructors-attributes.html results.
Copied: branches/safari-537-branch/LayoutTests/media/track/track-legacyapi-with-automatic-mode-expected.txt (from rev 152422, trunk/LayoutTests/media/track/track-legacyapi-with-automatic-mode-expected.txt) (0 => 152506)
--- branches/safari-537-branch/LayoutTests/media/track/track-legacyapi-with-automatic-mode-expected.txt (rev 0)
+++ branches/safari-537-branch/LayoutTests/media/track/track-legacyapi-with-automatic-mode-expected.txt 2013-07-09 18:27:04 UTC (rev 152506)
@@ -0,0 +1,30 @@
+Test that enabling a track with .webkitClosedCaptionsVisible succeeds when in "automatic" mode.
+
+
+** Setup
+RUN(internals.setCaptionDisplayMode('Automatic'))
+RUN(trackElement = document.createElement('track'))
+RUN(trackElement.kind = 'captions')
+RUN(trackElement.src = '')
+RUN(video.appendChild(trackElement))
+
+EVENT(canplaythrough)
+
+** Test initial state
+EXPECTED (video.textTracks.length == '1') OK
+EXPECTED (video.textTracks[0].mode == 'disabled') OK
+
+** Enable cues, allow them to load
+RUN(video.webkitClosedCaptionsVisible = true)
+EVENT(load)
+EXPECTED (track.readyState == '2') OK
+RUN(video.currentTime = 0.5)
+
+EVENT(seeked)
+
+** Check to make sure captions are displaying
+EXPECTED (video.textTracks[0].cues != 'null') OK
+EXPECTED (textTrackDisplayElement(video, 'cue').textContent != 'null') OK
+
+END OF TEST
+
Copied: branches/safari-537-branch/LayoutTests/media/track/track-legacyapi-with-automatic-mode.html (from rev 152422, trunk/LayoutTests/media/track/track-legacyapi-with-automatic-mode.html) (0 => 152506)
--- branches/safari-537-branch/LayoutTests/media/track/track-legacyapi-with-automatic-mode.html (rev 0)
+++ branches/safari-537-branch/LayoutTests/media/track/track-legacyapi-with-automatic-mode.html 2013-07-09 18:27:04 UTC (rev 152506)
@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Enabling a track with legacy API succeeds when in "Automatic" mode</title>
+
+ <script src=""
+ <script src=""
+ <script src=""
+ <script src=""
+ <script>
+
+ function seeked()
+ {
+ consoleWrite("<br><i>** Check to make sure captions are displaying<" + "/i>");
+
+ testExpected("video.textTracks[0].cues", null, '!=');
+ testExpected("textTrackDisplayElement(video, 'cue').textContent", null, '!=');
+
+ consoleWrite("");
+ endTest();
+ }
+
+ function trackLoaded()
+ {
+ consoleWrite("EVENT(load)");
+ track = event.target;
+ testExpected("track.readyState", HTMLTrackElement.LOADED);
+ run("video.currentTime = 0.5");
+ waitForEvent('seeked', seeked);
+ consoleWrite("");
+ }
+
+ function canplaythrough()
+ {
+ consoleWrite("<br><i>** Test initial state<" + "/i>");
+ testExpected("video.textTracks.length", 1);
+ testExpected("video.textTracks[0].mode", "disabled");
+
+ consoleWrite("<br><i>** Enable cues, allow them to load<" + "/i>");
+ run("video.webkitClosedCaptionsVisible = true");
+ }
+
+ function setup()
+ {
+ consoleWrite("<br><i>** Setup<" + "/i>");
+ findMediaElement();
+
+ if (window.internals)
+ run("internals.setCaptionDisplayMode('Automatic')");
+ run("trackElement = document.createElement('track')");
+ run("trackElement.kind = 'captions'");
+ run("trackElement.src = ''");
+ run("video.appendChild(trackElement)");
+
+ video.src = "" '../content/test');
+ trackElement.setAttribute('onload', 'trackLoaded()');
+ waitForEvent('canplaythrough', canplaythrough);
+ consoleWrite("");
+ }
+
+ </script>
+ </head>
+ <body _onload_="setup()">
+ <video controls width=500></video>
+ <p>Test that enabling a track with .webkitClosedCaptionsVisible succeeds when in "automatic" mode.</p>
+ </body>
+</html>
Modified: branches/safari-537-branch/Source/WebCore/ChangeLog (152505 => 152506)
--- branches/safari-537-branch/Source/WebCore/ChangeLog 2013-07-09 18:21:30 UTC (rev 152505)
+++ branches/safari-537-branch/Source/WebCore/ChangeLog 2013-07-09 18:27:04 UTC (rev 152506)
@@ -1,5 +1,31 @@
2013-07-09 Lucas Forschler <[email protected]>
+ Merge r152422
+
+ 2013-07-05 Eric Carlson <[email protected]>
+
+ [Mac] .webkitClosedCaptionsVisible doesn't work with "Automatic" caption mode
+ https://bugs.webkit.org/show_bug.cgi?id=118319
+
+ Reviewed by Jer Noble.
+
+ Track when captions are enabled with the old 'webkitClosedCaptionsVisible' attribute and
+ consider that when determining which track should be enabled.
+
+ Test: media/track/track-legacyapi-with-automatic-mode.html
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::HTMLMediaElement): Initialize m_webkitLegacyClosedCaptionOverride.
+ (WebCore::HTMLMediaElement::setWebkitClosedCaptionsVisible): Set m_webkitLegacyClosedCaptionOverride.
+ (WebCore::HTMLMediaElement::webkitClosedCaptionsVisible): Return m_webkitLegacyClosedCaptionOverride.
+ * html/HTMLMediaElement.h:
+
+ * page/CaptionUserPreferencesMediaAF.cpp:
+ (WebCore::CaptionUserPreferencesMediaAF::textTrackSelectionScore): Don't apply "automatic"
+ logic when captions were enabled with .webkitClosedCaptionsVisible.
+
+2013-07-09 Lucas Forschler <[email protected]>
+
Merge r152383
2013-07-03 Brent Fulgham <[email protected]>
Modified: branches/safari-537-branch/Source/WebCore/html/HTMLMediaElement.cpp (152505 => 152506)
--- branches/safari-537-branch/Source/WebCore/html/HTMLMediaElement.cpp 2013-07-09 18:21:30 UTC (rev 152505)
+++ branches/safari-537-branch/Source/WebCore/html/HTMLMediaElement.cpp 2013-07-09 18:27:04 UTC (rev 152506)
@@ -299,6 +299,7 @@
, m_sendProgressEvents(true)
, m_isFullscreen(false)
, m_closedCaptionsVisible(false)
+ , m_webkitLegacyClosedCaptionOverride(false)
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
, m_needWidgetUpdate(false)
#endif
@@ -4521,12 +4522,13 @@
void HTMLMediaElement::setWebkitClosedCaptionsVisible(bool visible)
{
+ m_webkitLegacyClosedCaptionOverride = visible;
setClosedCaptionsVisible(visible);
}
bool HTMLMediaElement::webkitClosedCaptionsVisible() const
{
- return m_closedCaptionsVisible;
+ return m_webkitLegacyClosedCaptionOverride && m_closedCaptionsVisible;
}
Modified: branches/safari-537-branch/Source/WebCore/html/HTMLMediaElement.h (152505 => 152506)
--- branches/safari-537-branch/Source/WebCore/html/HTMLMediaElement.h 2013-07-09 18:21:30 UTC (rev 152505)
+++ branches/safari-537-branch/Source/WebCore/html/HTMLMediaElement.h 2013-07-09 18:27:04 UTC (rev 152506)
@@ -714,6 +714,7 @@
bool m_isFullscreen : 1;
bool m_closedCaptionsVisible : 1;
+ bool m_webkitLegacyClosedCaptionOverride : 1;
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
bool m_needWidgetUpdate : 1;
Modified: branches/safari-537-branch/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp (152505 => 152506)
--- branches/safari-537-branch/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp 2013-07-09 18:21:30 UTC (rev 152505)
+++ branches/safari-537-branch/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp 2013-07-09 18:27:04 UTC (rev 152506)
@@ -678,7 +678,7 @@
Vector<String> userPreferredCaptionLanguages = preferredLanguages();
- if (displayMode == Automatic || trackHasOnlyForcedSubtitles) {
+ if ((displayMode == Automatic && !legacyOverride) || trackHasOnlyForcedSubtitles) {
if (!mediaElement || !mediaElement->player())
return 0;