- Revision
- 139932
- Author
- commit-qu...@webkit.org
- Date
- 2013-01-16 15:57:50 -0800 (Wed, 16 Jan 2013)
Log Message
Cues not rendered when they should be
https://bugs.webkit.org/show_bug.cgi?id=106943
Patch by Victor Carbune <vcarb...@chromium.org> on 2013-01-16
Reviewed by Eric Carlson.
Source/WebCore:
Forced rendering update, even if the active set of cues didn't change.
Test: media/track/track-cue-rendering-mode-changed.html
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::updateActiveTextTrackCues): If exiting early,
update the cues rendered by the text track container.
(WebCore::HTMLMediaElement::textTrackModeChanged): Trigger update of the
re-checking the active cues and render the ones not yet on screen.
LayoutTests:
* media/track/track-cue-rendering-mode-changed-expected.txt: Added.
* media/track/track-cue-rendering-mode-changed.html: Added.
* media/video-controls-captions-expected.txt: Updated.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (139931 => 139932)
--- trunk/LayoutTests/ChangeLog 2013-01-16 23:23:57 UTC (rev 139931)
+++ trunk/LayoutTests/ChangeLog 2013-01-16 23:57:50 UTC (rev 139932)
@@ -1,3 +1,14 @@
+2013-01-16 Victor Carbune <vcarb...@chromium.org>
+
+ Cues not rendered when they should be
+ https://bugs.webkit.org/show_bug.cgi?id=106943
+
+ Reviewed by Eric Carlson.
+
+ * media/track/track-cue-rendering-mode-changed-expected.txt: Added.
+ * media/track/track-cue-rendering-mode-changed.html: Added.
+ * media/video-controls-captions-expected.txt: Updated.
+
2013-01-16 Sheriff Bot <webkit.review....@gmail.com>
Unreviewed, rolling out r139853.
Added: trunk/LayoutTests/media/track/track-cue-rendering-mode-changed-expected.txt (0 => 139932)
--- trunk/LayoutTests/media/track/track-cue-rendering-mode-changed-expected.txt (rev 0)
+++ trunk/LayoutTests/media/track/track-cue-rendering-mode-changed-expected.txt 2013-01-16 23:57:50 UTC (rev 139932)
@@ -0,0 +1,26 @@
+Test that cues are rendered when only the track mode is changed
+EVENT(canplaythrough)
+
+Add 'Arabic' text track with one cue
+Add 'English' text track with one cue
+
+Set the mode of the 'Arabic' track to showing
+Set the mode of the 'English' track to hidden
+
+** Both cues should be active **
+EXPECTED (testTrackEnglish.activeCues.length == '1') OK
+EXPECTED (testTrackEnglish.activeCues[0].text == 'English') OK
+EXPECTED (testTrackArabic.activeCues.length == '1') OK
+EXPECTED (testTrackArabic.activeCues[0].text == 'Arabic') OK
+
+** Only one cue should be visible **
+EXPECTED (testCueDisplayBox.innerText == 'Arabic') OK
+EXPECTED (testCueDisplayBox.nextSibling == 'null') OK
+
+Set the mode of the 'English' track to showing
+
+** Both cues shold be visible. **
+EXPECTED (testCueDisplayBox.innerText == 'Arabic') OK
+EXPECTED (testCueDisplayBox.innerText == 'English') OK
+END OF TEST
+
Added: trunk/LayoutTests/media/track/track-cue-rendering-mode-changed.html (0 => 139932)
--- trunk/LayoutTests/media/track/track-cue-rendering-mode-changed.html (rev 0)
+++ trunk/LayoutTests/media/track/track-cue-rendering-mode-changed.html 2013-01-16 23:57:50 UTC (rev 139932)
@@ -0,0 +1,90 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+ <script src=""
+ <script src=""
+ <script src=""
+
+ <script>
+
+ var testTrackArabic;
+ var testTrackEnglish;
+ var testCueDisplayBox;
+
+ function addTracks()
+ {
+ consoleWrite("");
+
+ consoleWrite("Add 'Arabic' text track with one cue");
+ testTrackArabic = video.addTextTrack('captions', 'Arabic', 'ar');
+ testTrackArabic.addCue(new TextTrackCue(0.0, 10.0, 'Arabic'));
+
+ consoleWrite("Add 'English' text track with one cue");
+ testTrackEnglish = video.addTextTrack('captions', 'English', 'en');
+ testTrackEnglish.addCue(new TextTrackCue(0.0, 10.0, 'English'));
+
+ consoleWrite("");
+ consoleWrite("Set the mode of the 'Arabic' track to showing");
+ testTrackArabic.mode = "showing";
+
+ consoleWrite("Set the mode of the 'English' track to hidden");
+ testTrackEnglish.mode = "hidden";
+ }
+
+ function testCueActiveState()
+ {
+ consoleWrite("");
+ consoleWrite("** Both cues should be active **");
+ testExpected("testTrackEnglish.activeCues.length", 1);
+ testExpected("testTrackEnglish.activeCues[0].text", "English");
+
+ testExpected("testTrackArabic.activeCues.length", 1);
+ testExpected("testTrackArabic.activeCues[0].text", "Arabic");
+ }
+
+ function testCueVisibility()
+ {
+ consoleWrite("");
+ consoleWrite("** Only one cue should be visible **");
+ testCueDisplayBox = textTrackDisplayElement(video, 'display', 0);
+ testExpected("testCueDisplayBox.innerText", "Arabic");
+ testExpected("testCueDisplayBox.nextSibling", null);
+
+ consoleWrite("");
+ consoleWrite("Set the mode of the 'English' track to showing");
+ testTrackEnglish.mode = "showing";
+
+ consoleWrite("");
+ consoleWrite("** Both cues shold be visible. **");
+ testCueDisplayBox = textTrackDisplayElement(video, 'display', 0);
+ testExpected("testCueDisplayBox.innerText", "Arabic");
+
+ testCueDisplayBox = textTrackDisplayElement(video, 'display', 1);
+ testExpected("testCueDisplayBox.innerText", "English");
+ }
+
+ function runTests() {
+ addTracks();
+ testCueActiveState();
+ testCueVisibility();
+ endTest();
+ }
+
+ function loaded()
+ {
+ consoleWrite("Test that cues are rendered when only the track mode is changed");
+
+ findMediaElement();
+ video.src = "" '../content/test');
+
+ waitForEvent('canplaythrough', runTests);
+ }
+
+ </script>
+ </head>
+ <body _onload_="loaded()">
+ <video controls ></video>
+ </body>
+</html>
Modified: trunk/LayoutTests/media/video-controls-captions-expected.txt (139931 => 139932)
--- trunk/LayoutTests/media/video-controls-captions-expected.txt 2013-01-16 23:23:57 UTC (rev 139931)
+++ trunk/LayoutTests/media/video-controls-captions-expected.txt 2013-01-16 23:57:50 UTC (rev 139932)
@@ -12,7 +12,7 @@
** The captions track should be listed in textTracks, but not yet loaded. **
EXPECTED (video.textTracks.length == '1') OK
EXPECTED (video.textTracks[0].mode == 'disabled') OK
-Failed to find text track container element
+No text track cue with display id '-webkit-media-text-track-display' is currently visible
** Captions track should load and captions should become visible after button is clicked **
*** Click the CC button.
Modified: trunk/Source/WebCore/ChangeLog (139931 => 139932)
--- trunk/Source/WebCore/ChangeLog 2013-01-16 23:23:57 UTC (rev 139931)
+++ trunk/Source/WebCore/ChangeLog 2013-01-16 23:57:50 UTC (rev 139932)
@@ -1,3 +1,20 @@
+2013-01-16 Victor Carbune <vcarb...@chromium.org>
+
+ Cues not rendered when they should be
+ https://bugs.webkit.org/show_bug.cgi?id=106943
+
+ Reviewed by Eric Carlson.
+
+ Forced rendering update, even if the active set of cues didn't change.
+
+ Test: media/track/track-cue-rendering-mode-changed.html
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::updateActiveTextTrackCues): If exiting early,
+ update the cues rendered by the text track container.
+ (WebCore::HTMLMediaElement::textTrackModeChanged): Trigger update of the
+ re-checking the active cues and render the ones not yet on screen.
+
2013-01-16 Benjamin Poulain <bpoul...@apple.com>
Force a rebuild of RenderObject
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (139931 => 139932)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2013-01-16 23:23:57 UTC (rev 139931)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2013-01-16 23:57:50 UTC (rev 139932)
@@ -1166,8 +1166,15 @@
activeSetChanged = true;
}
- if (!activeSetChanged)
+ if (!activeSetChanged) {
+ // Even though the active set has not changed, it is possible that the
+ // the mode of a track has changed from 'hidden' to 'showing' and the
+ // cues have not yet been rendered.
+ if (hasMediaControls())
+ mediaControls()->updateTextTrackDisplay();
+
return;
+ }
// 7 - If the time was reached through the usual monotonic increase of the
// current playback position during normal playback, and there are cues in
@@ -1361,6 +1368,7 @@
}
configureTextTrackDisplay();
+ updateActiveTextTrackCues(currentTime());
}
void HTMLMediaElement::textTrackKindChanged(TextTrack* track)