Diff
Modified: trunk/LayoutTests/ChangeLog (114025 => 114026)
--- trunk/LayoutTests/ChangeLog 2012-04-12 20:26:49 UTC (rev 114025)
+++ trunk/LayoutTests/ChangeLog 2012-04-12 20:29:50 UTC (rev 114026)
@@ -1,3 +1,14 @@
+2012-04-12 Anna Cavender <[email protected]>
+
+ Update HTMLMediaElement's index of cues when TextTrack.mode changes to
+ and from TextTrack::DISABLED.
+ https://bugs.webkit.org/show_bug.cgi?id=83377
+
+ Reviewed by Eric Carlson.
+
+ * media/track/track-mode-expected.txt:
+ * media/track/track-mode.html:
+
2012-04-12 Sheriff Bot <[email protected]>
Unreviewed, rolling out r114005.
Added: trunk/LayoutTests/media/track/captions-webvtt/captions-fast.vtt (0 => 114026)
--- trunk/LayoutTests/media/track/captions-webvtt/captions-fast.vtt (rev 0)
+++ trunk/LayoutTests/media/track/captions-webvtt/captions-fast.vtt 2012-04-12 20:29:50 UTC (rev 114026)
@@ -0,0 +1,17 @@
+WEBVTT
+
+1
+00:00:00.000 --> 00:00:00.200
+Lorem
+
+2
+00:00:00.200 --> 00:00:00.500
+ipsum
+
+3
+00:00:00.500 --> 00:00:00.800
+dolor
+
+4
+00:00:00.800 --> 00:00:01.000
+sit
Modified: trunk/LayoutTests/media/track/track-mode-expected.txt (114025 => 114026)
--- trunk/LayoutTests/media/track/track-mode-expected.txt 2012-04-12 20:26:49 UTC (rev 114025)
+++ trunk/LayoutTests/media/track/track-mode-expected.txt 2012-04-12 20:29:50 UTC (rev 114026)
@@ -15,16 +15,30 @@
RUN(textTrack.mode = '0')
EXPECTED (textTrack.mode == '0') OK
EXPECTED (video.textTracks[0].mode == '0') OK
+EXPECTED (textTrack.cues == 'null') OK
+++ 0 events expected while mode = TextTrack.DISABLED
+
++ 'TextTrack.HIDDEN'
RUN(textTrack.mode = '1')
+EVENT(cuechange)
+EXPECTED (textTrack.activeCues.length == '1'), OBSERVED '0' FAIL
EXPECTED (textTrack.mode == '1') OK
EXPECTED (video.textTracks[0].mode == '1') OK
+EXPECTED (textTrack.cues.length == '4') OK
++ 'TextTrack.SHOWING'
RUN(textTrack.mode = '2')
EXPECTED (textTrack.mode == '2') OK
EXPECTED (video.textTracks[0].mode == '2') OK
+EXPECTED (textTrack.cues.length == '4') OK
+++ 3 events expected while mode = TextTrack.SHOWING
+EVENT(cuechange)
+EXPECTED (textTrack.activeCues.length == '1') OK
+EVENT(cuechange)
+EXPECTED (textTrack.activeCues.length == '1') OK
+EVENT(cuechange)
+EXPECTED (textTrack.activeCues.length == '1') OK
END OF TEST
Modified: trunk/LayoutTests/media/track/track-mode.html (114025 => 114026)
--- trunk/LayoutTests/media/track/track-mode.html 2012-04-12 20:26:49 UTC (rev 114025)
+++ trunk/LayoutTests/media/track/track-mode.html 2012-04-12 20:29:50 UTC (rev 114026)
@@ -7,17 +7,24 @@
<script>
var textTrack;
+ var cueCount;
+
function setMode(value)
{
run("textTrack.mode = '" + value + "'");
testExpected("textTrack.mode", value);
testExpected("video.textTracks[0].mode", value);
+ if (value == TextTrack.DISABLED)
+ testExpected("textTrack.cues", null);
+ else
+ testExpected("textTrack.cues.length", textTrack.cues.length);
consoleWrite("");
}
function start()
{
findMediaElement();
+ cueCount = 0;
consoleWrite("");
textTrack = document.getElementById('track_1').track;
@@ -38,21 +45,42 @@
consoleWrite("<b>++ 'TextTrack.DISABLED'</b>");
setMode(TextTrack.DISABLED);
+ video.src = "" "../content/test");
+ video.play();
+ // Wait for end of first cue (no events should fire while track is disabled).
+ setTimeout(testHiddenAndShowing, 300);
+ consoleWrite("++ 0 events expected while mode = TextTrack.DISABLED");
+ consoleWrite("");
+ }
+
+ function testHiddenAndShowing()
+ {
consoleWrite("<b>++ 'TextTrack.HIDDEN'</b>");
setMode(TextTrack.HIDDEN);
consoleWrite("<b>++ 'TextTrack.SHOWING'</b>");
setMode(TextTrack.SHOWING);
- endTest();
+ consoleWrite("++ " + (textTrack.cues.length - 1) + " events expected while mode = TextTrack.SHOWING");
}
+
+ waitForEvent('cuechange',
+ function ()
+ {
+ testExpected("textTrack.activeCues.length", 1);
+ cueCount++;
+ if (cueCount == textTrack.cues.length)
+ endTest();
+ }
+ );
+
</script>
</head>
<body>
<p>Tests that the TextTrack mode attribute is appropriately set.</p>
<video>
- <track id=track_1 src="" _onload_="start()" default>
+ <track id=track_1 src="" _onload_="start()" default>
</video>
</body>
</html>
Modified: trunk/Source/WebCore/ChangeLog (114025 => 114026)
--- trunk/Source/WebCore/ChangeLog 2012-04-12 20:26:49 UTC (rev 114025)
+++ trunk/Source/WebCore/ChangeLog 2012-04-12 20:29:50 UTC (rev 114026)
@@ -1,3 +1,25 @@
+2012-04-12 Anna Cavender <[email protected]>
+
+ Update HTMLMediaElement's index of cues when TextTrack.mode changes to
+ and from TextTrack::DISABLED.
+ https://bugs.webkit.org/show_bug.cgi?id=83377
+
+ Reviewed by Eric Carlson.
+
+ No new tests. Instead updated media/track/track-mode.html
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::textTrackModeChanged):
+ Add the track's cues to the index when the mode changes to HIDDEN or SHOWING.
+
+ * html/HTMLTrackElement.cpp:
+ (WebCore::HTMLTrackElement::textTrackRemoveCues):
+ Fix a copy pasta error.
+
+ * html/track/TextTrack.cpp:
+ (WebCore::TextTrack::setMode):
+ Remove the track's cues from the index when the mode changes to DISABLED.
+
2012-04-12 Cem Kocagil <[email protected]>
Allow certain Char events in fullscreen
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (114025 => 114026)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2012-04-12 20:26:49 UTC (rev 114025)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2012-04-12 20:29:50 UTC (rev 114026)
@@ -1255,8 +1255,12 @@
// Mark this track as "configured" so configureNewTextTracks won't change the mode again.
trackElement->setHasBeenConfigured(true);
- if (track->mode() != TextTrack::DISABLED && trackElement->readyState() == HTMLTrackElement::NONE)
- trackElement->scheduleLoad();
+ if (track->mode() != TextTrack::DISABLED) {
+ if (trackElement->readyState() == HTMLTrackElement::LOADED)
+ textTrackAddCues(track, track->cues());
+ else if (trackElement->readyState() == HTMLTrackElement::NONE)
+ trackElement->scheduleLoad();
+ }
break;
}
}
Modified: trunk/Source/WebCore/html/HTMLTrackElement.cpp (114025 => 114026)
--- trunk/Source/WebCore/html/HTMLTrackElement.cpp 2012-04-12 20:26:49 UTC (rev 114025)
+++ trunk/Source/WebCore/html/HTMLTrackElement.cpp 2012-04-12 20:29:50 UTC (rev 114026)
@@ -315,7 +315,7 @@
void HTMLTrackElement::textTrackRemoveCues(TextTrack* track, const TextTrackCueList* cues)
{
if (HTMLMediaElement* parent = mediaElement())
- return parent->textTrackAddCues(track, cues);
+ return parent->textTrackRemoveCues(track, cues);
}
void HTMLTrackElement::textTrackAddCue(TextTrack* track, PassRefPtr<TextTrackCue> cue)
Modified: trunk/Source/WebCore/html/track/TextTrack.cpp (114025 => 114026)
--- trunk/Source/WebCore/html/track/TextTrack.cpp 2012-04-12 20:26:49 UTC (rev 114025)
+++ trunk/Source/WebCore/html/track/TextTrack.cpp 2012-04-12 20:29:50 UTC (rev 114026)
@@ -139,6 +139,11 @@
if (m_mode == static_cast<Mode>(mode))
return;
+ // If mode changes to disabled, remove this track's cues from the client
+ // because they will no longer be accessible from the cues() function.
+ if (mode == TextTrack::DISABLED && m_client && m_cues)
+ m_client->textTrackRemoveCues(this, m_cues.get());
+
// ... Note: If the mode had been showing by default, this will change it to showing,
// even though the value of mode would appear not to change.
m_mode = static_cast<Mode>(mode);