Title: [149906] trunk
Revision
149906
Author
[email protected]
Date
2013-05-10 14:11:51 -0700 (Fri, 10 May 2013)

Log Message

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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (149905 => 149906)


--- trunk/LayoutTests/ChangeLog	2013-05-10 20:54:54 UTC (rev 149905)
+++ trunk/LayoutTests/ChangeLog	2013-05-10 21:11:51 UTC (rev 149906)
@@ -1,3 +1,19 @@
+2013-05-10  Eric Carlson  <[email protected]>
+
+        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  <[email protected]>
 
         Unreviewed mac-lion rebaselines.

Added: trunk/LayoutTests/media/track/track-in-band-mode-expected.txt (0 => 149906)


--- trunk/LayoutTests/media/track/track-in-band-mode-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/track/track-in-band-mode-expected.txt	2013-05-10 21:11:51 UTC (rev 149906)
@@ -0,0 +1,24 @@
+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
+

Added: trunk/LayoutTests/media/track/track-in-band-mode.html (0 => 149906)


--- trunk/LayoutTests/media/track/track-in-band-mode.html	                        (rev 0)
+++ trunk/LayoutTests/media/track/track-in-band-mode.html	2013-05-10 21:11:51 UTC (rev 149906)
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>In-band track cues displayed immediately</title>
+
+        <script src=""
+        <script src=""
+        <script src=""
+        <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 = '';
+                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>

Modified: trunk/LayoutTests/platform/efl/TestExpectations (149905 => 149906)


--- trunk/LayoutTests/platform/efl/TestExpectations	2013-05-10 20:54:54 UTC (rev 149905)
+++ trunk/LayoutTests/platform/efl/TestExpectations	2013-05-10 21:11:51 UTC (rev 149906)
@@ -1618,6 +1618,7 @@
 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 ]

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (149905 => 149906)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2013-05-10 20:54:54 UTC (rev 149905)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2013-05-10 21:11:51 UTC (rev 149906)
@@ -389,6 +389,7 @@
 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 ]

Modified: trunk/LayoutTests/platform/mac/TestExpectations (149905 => 149906)


--- trunk/LayoutTests/platform/mac/TestExpectations	2013-05-10 20:54:54 UTC (rev 149905)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2013-05-10 21:11:51 UTC (rev 149906)
@@ -1353,6 +1353,7 @@
 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 ]

Modified: trunk/LayoutTests/platform/qt/TestExpectations (149905 => 149906)


--- trunk/LayoutTests/platform/qt/TestExpectations	2013-05-10 20:54:54 UTC (rev 149905)
+++ trunk/LayoutTests/platform/qt/TestExpectations	2013-05-10 21:11:51 UTC (rev 149906)
@@ -2641,6 +2641,7 @@
 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

Modified: trunk/LayoutTests/platform/win/TestExpectations (149905 => 149906)


--- trunk/LayoutTests/platform/win/TestExpectations	2013-05-10 20:54:54 UTC (rev 149905)
+++ trunk/LayoutTests/platform/win/TestExpectations	2013-05-10 21:11:51 UTC (rev 149906)
@@ -2529,6 +2529,7 @@
 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

Modified: trunk/Source/WebCore/ChangeLog (149905 => 149906)


--- trunk/Source/WebCore/ChangeLog	2013-05-10 20:54:54 UTC (rev 149905)
+++ trunk/Source/WebCore/ChangeLog	2013-05-10 21:11:51 UTC (rev 149906)
@@ -1,3 +1,16 @@
+2013-05-10  Eric Carlson  <[email protected]>
+
+        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  <[email protected]>
 
         Web Inspector: determine the resource type in InspectorResourceAgent::willSendRequest.

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (149905 => 149906)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2013-05-10 20:54:54 UTC (rev 149905)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2013-05-10 21:11:51 UTC (rev 149906)
@@ -1388,34 +1388,32 @@
 
 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());
+            HTMLTrackElement* trackElement = static_cast<HTMLTrackElement*>(node);
+            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());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to