In-band captions not visible immediately after track mode change

https://bugs.webkit.org/show_bug.cgi?id=115922

Reviewed by Dean Jackson.

Source/WebCore: 

Test: media/track/track-in-band-mode.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::textTrackModeChanged): Add cues for all loaded tracks, regardless
    of track type.

LayoutTests: 

* media/track/track-in-band-mode-expected.txt: Added.
* media/track/track-in-band-mode.html: Added.

* platform/efl/TestExpectations: Skip new test.
* platform/gtk/TestExpectations: Ditto.
* platform/mac/TestExpectations: Ditto.
* platform/qt/TestExpectations: Ditto.
* platform/win/TestExpectations: Ditto.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149906 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2654127d
2013-05-10 Eric Carlson <eric.carlson@apple.com>
In-band captions not visible immediately after track mode change
https://bugs.webkit.org/show_bug.cgi?id=115922
Reviewed by Dean Jackson.
* media/track/track-in-band-mode-expected.txt: Added.
* media/track/track-in-band-mode.html: Added.
* platform/efl/TestExpectations: Skip new test.
* platform/gtk/TestExpectations: Ditto.
* platform/mac/TestExpectations: Ditto.
* platform/qt/TestExpectations: Ditto.
* platform/win/TestExpectations: Ditto.
2013-05-10 Roger Fong <roger_fong@apple.com>
Unreviewed mac-lion rebaselines.
......
Test that cues from in-band tracks are displayed immediately when a track is made visible.
EVENT(canplaythrough)
** Check initial in-band track states
RUN(inbandTrack1 = video.textTracks[0])
EXPECTED (video.textTracks.length == '1') OK
EXPECTED (inbandTrack1.language == 'en') OK
EXPECTED (inbandTrack1.kind == 'captions') OK
** A hidden track should not have visible cues
RUN(inbandTrack1.mode = 'hidden')
EXPECTED (inbandTrack1.activeCues.length == '0') OK
RUN(video.play())
EVENT(seeked)
No text track cue with display id 'cue' is currently visible
** Showing a track should show active cues immediately
RUN(inbandTrack1.mode = 'showing')
EXPECTED (textTrackDisplayElement(video, 'cue').textContent != 'null') OK
EXPECTED (inbandTrack1.activeCues.length == '1') OK
END OF TEST
<!DOCTYPE html>
<html>
<head>
<title>In-band track cues displayed immediately</title>
<script src=../media-file.js></script>
<script src=../video-test.js></script>
<script src=../media-controls.js></script>
<script>
function seeked()
{
testExpected("textTrackDisplayElement(video, 'cue')", null);
consoleWrite("<br><i>** Showing a track should show active cues immediately<" + "/i>");
run("inbandTrack1.mode = 'showing'");
testExpected("textTrackDisplayElement(video, 'cue').textContent", null, '!=');
testExpected("inbandTrack1.activeCues.length", 1);
consoleWrite("");
endTest();
}
function canplaythrough()
{
consoleWrite("<br><i>** Check initial in-band track states<" + "/i>");
run("inbandTrack1 = video.textTracks[0]");
testExpected("video.textTracks.length", 1);
testExpected("inbandTrack1.language", "en");
testExpected("inbandTrack1.kind", "captions");
consoleWrite("<br><i>** A hidden track should not have visible cues<" + "/i>");
run("inbandTrack1.mode = 'hidden'");
testExpected("inbandTrack1.activeCues.length", 0);
run("video.play()");
setTimeout(function() { video.pause(); video.currentTime = 0.5; }, 500);
}
function setup()
{
findMediaElement();
video.src = '../content/counting-captioned.mov';
waitForEvent('seeked', seeked);
waitForEvent('canplaythrough', canplaythrough);
}
</script>
</head>
<body onload="setup()">
<video controls></video>
<p>Test that cues from in-band tracks are displayed immediately when a track is made visible.</p>
</body>
</html>
......@@ -1618,6 +1618,7 @@ Bug(EFL) media/track/track-in-band-cues-added-once.html [ Skip ]
Bug(EFL) media/track/track-in-band-style.html [ Skip ]
Bug(EFL) media/track/track-in-band-legacy-api.html [ Skip ]
Bug(EFL) media/track/track-forced-subtitles-in-band.html [ Skip ]
Bug(EFL) media/track/track-in-band-mode.html [ Skip ]
# All debug bots timeout (crash) on this one
webkit.org/b/56496 [ Debug ] fast/js/array-sort-modifying-tostring.html [ Crash Pass ]
......
......@@ -389,6 +389,7 @@ webkit.org/b/103771 media/track/track-in-band.html [ Failure ]
webkit.org/b/103771 media/track/track-in-band-cues-added-once.html [ Timeout ]
webkit.org/b/103771 media/track/track-in-band-style.html [ Timeout ]
webkit.org/b/103771 media/track/track-in-band-legacy-api.html [ Failure ]
webkit.org/b/103771 media/track/track-in-band-mode.html [ Skip ]
#Incorrect rebaseline
webkit.org/b/107818 media/controls-styling.html [ Failure ]
......
......@@ -1353,6 +1353,7 @@ webkit.org/b/103663 [ MountainLion Lion SnowLeopard ] media/track/track-in-band-
webkit.org/b/103663 [ MountainLion Lion SnowLeopard ] media/track/track-in-band-style.html
webkit.org/b/103663 [ MountainLion Lion SnowLeopard ] media/track/track-in-band-legacy-api.html
webkit.org/b/103663 [ MountainLion Lion SnowLeopard ] media/track/track-forced-subtitles-in-band.html
webkit.org/b/103663 [ MountainLion Lion SnowLeopard ] media/track/track-in-band-mode.html
# These two tests sometimes timeout
webkit.org/b/112492 media/track/track-language-preference.html [ Failure Pass ]
......
......@@ -2641,6 +2641,7 @@ webkit.org/b/103769 media/track/track-in-band-cues-added-once.html [ Skip ]
webkit.org/b/103769 media/track/track-in-band-style.html [ Skip ]
webkit.org/b/103769 media/track/track-in-band-legacy-api.html [ Skip ]
webkit.org/b/103769 media/track/track-forced-subtitles-in-band.html [ Skip ]
webkit.org/b/103769 media/track/track-in-band-mode.html [ Skip ]
# [Qt] new http/tests/xmlhttprequest/post-blob-content-type-sync.html and ~async.html fail since introduced in r136893
# https://bugs.webkit.org/show_bug.cgi?id=104352
......
......@@ -2529,6 +2529,7 @@ webkit.org/b/103770 media/track/track-in-band-cues-added-once.html [ Skip ]
webkit.org/b/103770 media/track/track-in-band-style.html [ Skip ]
webkit.org/b/103770 media/track/track-in-band-legacy-api.html [ Skip ]
webkit.org/b/103770 media/track/track-forced-subtitles-in-band.html [ Skip ]
webkit.org/b/103770 media/track/track-in-band-mode.html [ Skip ]
# https://bugs.webkit.org/show_bug.cgi?id=97026
fast/events/keydown-leftright-keys.html
......
2013-05-10 Eric Carlson <eric.carlson@apple.com>
In-band captions not visible immediately after track mode change
https://bugs.webkit.org/show_bug.cgi?id=115922
Reviewed by Dean Jackson.
Test: media/track/track-in-band-mode.html
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::textTrackModeChanged): Add cues for all loaded tracks, regardless
of track type.
2013-05-10 Timothy Hatcher <timothy@apple.com>
Web Inspector: determine the resource type in InspectorResourceAgent::willSendRequest.
......
......@@ -1388,34 +1388,32 @@ void HTMLMediaElement::audioTrackEnabledChanged(AudioTrack*)
void HTMLMediaElement::textTrackModeChanged(TextTrack* track)
{
bool trackIsLoaded = true;
if (track->trackType() == TextTrack::TrackElement) {
// 4.8.10.12.3 Sourcing out-of-band text tracks
// ... when a text track corresponding to a track element is created with text track
// mode set to disabled and subsequently changes its text track mode to hidden, showing,
// or showing by default for the first time, the user agent must immediately and synchronously
// run the following algorithm ...
trackIsLoaded = false;
for (Node* node = firstChild(); node; node = node->nextSibling()) {
if (!node->hasTagName(trackTag))
continue;
HTMLTrackElement* trackElement = static_cast<HTMLTrackElement*>(node);
if (trackElement->track() != track)
continue;
// Mark this track as "configured" so configureTextTracks won't change the mode again.
track->setHasBeenConfigured(true);
if (track->mode() != TextTrack::disabledKeyword()) {
if (trackElement->readyState() == HTMLTrackElement::LOADED)
textTrackAddCues(track, track->cues());
// If this is the first added track, create the list of text tracks.
if (!m_textTracks)
m_textTracks = TextTrackList::create(this, ActiveDOMObject::scriptExecutionContext());
if (trackElement->track() == track) {
if (trackElement->readyState() == HTMLTrackElement::LOADING || trackElement->readyState() == HTMLTrackElement::LOADED)
trackIsLoaded = true;
break;
}
break;
}
}
// If this is the first added track, create the list of text tracks.
if (!m_textTracks)
m_textTracks = TextTrackList::create(this, ActiveDOMObject::scriptExecutionContext());
// Mark this track as "configured" so configureTextTracks won't change the mode again.
track->setHasBeenConfigured(true);
if (track->mode() != TextTrack::disabledKeyword() && trackIsLoaded)
textTrackAddCues(track, track->cues());
#if USE(PLATFORM_TEXT_TRACK_MENU)
if (platformTextTrackMenu())
platformTextTrackMenu()->trackWasSelected(track->platformTextTrack());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment