Title: [157290] trunk
Revision
157290
Author
[email protected]
Date
2013-10-10 23:16:23 -0700 (Thu, 10 Oct 2013)

Log Message

Track controls show metadata and chapter tracks
https://bugs.webkit.org/show_bug.cgi?id=122468

Patch by Brendan Long <[email protected]> on 2013-10-10
Reviewed by Darin Adler.

Source/WebCore:

Test: media/video-controls-captions-trackmenu-only-captions-descriptions-and-subtitles.html

* page/CaptionUserPreferences.cpp:
(WebCore::CaptionUserPreferences::sortedTrackListForMenu): Only show captions, descriptions and subtitles in the track controls.

LayoutTests:

Add a test to make sure we don't show metadata and chapter tracks in the track controls.

* media/video-controls-captions-trackmenu-only-captions-descriptions-and-subtitles-expected.txt: Added.
* media/video-controls-captions-trackmenu-only-captions-descriptions-and-subtitles.html: Added.
* platform/efl/TestExpectations: Skip, uses caption button, not track menu.
* platform/mac/TestExpectations: Skip, track menu tests all fail on Mac.
* platform/win/TestExpectations: Same.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (157289 => 157290)


--- trunk/LayoutTests/ChangeLog	2013-10-11 04:55:47 UTC (rev 157289)
+++ trunk/LayoutTests/ChangeLog	2013-10-11 06:16:23 UTC (rev 157290)
@@ -1,3 +1,18 @@
+2013-10-10  Brendan Long  <[email protected]>
+
+        Track controls show metadata and chapter tracks
+        https://bugs.webkit.org/show_bug.cgi?id=122468
+
+        Reviewed by Darin Adler.
+
+        Add a test to make sure we don't show metadata and chapter tracks in the track controls.
+
+        * media/video-controls-captions-trackmenu-only-captions-descriptions-and-subtitles-expected.txt: Added.
+        * media/video-controls-captions-trackmenu-only-captions-descriptions-and-subtitles.html: Added.
+        * platform/efl/TestExpectations: Skip, uses caption button, not track menu.
+        * platform/mac/TestExpectations: Skip, track menu tests all fail on Mac.
+        * platform/win/TestExpectations: Same.
+
 2013-10-10  Ryosuke Niwa  <[email protected]>
 
         Add failing expectations to some tests on Mac Lion.

Added: trunk/LayoutTests/media/video-controls-captions-trackmenu-only-captions-descriptions-and-subtitles-expected.txt (0 => 157290)


--- trunk/LayoutTests/media/video-controls-captions-trackmenu-only-captions-descriptions-and-subtitles-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/video-controls-captions-trackmenu-only-captions-descriptions-and-subtitles-expected.txt	2013-10-11 06:16:23 UTC (rev 157290)
@@ -0,0 +1,8 @@
+Test that the track menu only shows captions, descriptions and subtitles.
+
+EVENT(canplaythrough)
+There are 3 caption, description or subtitles tracks.
+Because of "Off" and "Auto", there should be 5 items in the menu.
+EXPECTED (trackListItems.length == '5') OK
+END OF TEST
+

Added: trunk/LayoutTests/media/video-controls-captions-trackmenu-only-captions-descriptions-and-subtitles.html (0 => 157290)


--- trunk/LayoutTests/media/video-controls-captions-trackmenu-only-captions-descriptions-and-subtitles.html	                        (rev 0)
+++ trunk/LayoutTests/media/video-controls-captions-trackmenu-only-captions-descriptions-and-subtitles.html	2013-10-11 06:16:23 UTC (rev 157290)
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>Selecting from a list of tracks</title>
+        <script src=""
+        <script src=""
+        <script src=""
+        <script src=""
+        <script>
+            if (window.testRunner)
+                testRunner.dumpAsText();
+
+            function testMenu()
+            {
+                showTrackMenu();
+                trackListItems = trackMenuList();
+                var matchingTracks = 0;
+                for (var i = 0; i < video.textTracks.length; ++i) {
+                    var kind = video.textTracks[i].kind;
+                    if (kind == "captions" || kind == "descriptions" || kind == "subtitles")
+                        ++matchingTracks;
+                }
+                consoleWrite("There are " + matchingTracks + " caption, description or subtitles tracks.");
+                
+                var expectedItemCount = matchingTracks + 2;
+                consoleWrite("Because of \"Off\" and \"Auto\", there should be " + expectedItemCount + " items in the menu.");
+                testExpected("trackListItems.length", expectedItemCount);
+                endTest();
+            }
+
+            function start()
+            {
+                findMediaElement();
+                video.src = "" 'content/test');
+                waitForEvent('canplaythrough', testMenu);
+            }
+        </script>
+    </head>
+
+    <body _onload_="start()">
+        <p>Test that the track menu only shows captions, descriptions and subtitles.</p>
+        <video width="500" height="300" controls>
+            <track kind="captions" src="" srclang="fr">
+            <track kind="chapters" src="" srclang="en">
+            <track kind="descriptions" src="" srclang="en">
+            <track kind="metadata" src="" srclang="en">
+            <track kind="subtitles" src="" srclang="ja">
+        </video>
+    </body>
+</html>
+

Modified: trunk/LayoutTests/platform/efl/TestExpectations (157289 => 157290)


--- trunk/LayoutTests/platform/efl/TestExpectations	2013-10-11 04:55:47 UTC (rev 157289)
+++ trunk/LayoutTests/platform/efl/TestExpectations	2013-10-11 06:16:23 UTC (rev 157290)
@@ -1408,6 +1408,7 @@
 webkit.org/b/101670 media/video-controls-captions-trackmenu-hide-on-click-outside.html [ Skip ]
 webkit.org/b/101670 media/track/track-user-preferences.html [ Skip ]
 webkit.org/b/101670 media/video-controls-captions-trackmenu-includes-enabled-track.html [ Skip ]
+webkit.org/b/101670 media/video-controls-captions-trackmenu-only-captions-descriptions-and-subtitles.html [ Skip ]
 
 # Fails until we enable the Resource Timing API.
 webkit.org/b/61138 http/tests/w3c/webperf/submission/Google/resource-timing [ Skip ]

Modified: trunk/LayoutTests/platform/mac/TestExpectations (157289 => 157290)


--- trunk/LayoutTests/platform/mac/TestExpectations	2013-10-11 04:55:47 UTC (rev 157289)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2013-10-11 06:16:23 UTC (rev 157290)
@@ -1257,6 +1257,7 @@
 webkit.org/b/122021 media/video-controls-rendering.html
 webkit.org/b/122021 media/video-controls-toggling.html
 webkit.org/b/122021 media/video-controls-visible-exiting-fullscreen.html
+webkit.org/b/122021 media/video-controls-captions-trackmenu-only-captions-descriptions-and-subtitles.html
 webkit.org/b/122021 media/video-display-toggle.html
 webkit.org/b/122021 media/video-empty-source.html
 webkit.org/b/122021 media/video-rtl.html

Modified: trunk/LayoutTests/platform/win/TestExpectations (157289 => 157290)


--- trunk/LayoutTests/platform/win/TestExpectations	2013-10-11 04:55:47 UTC (rev 157289)
+++ trunk/LayoutTests/platform/win/TestExpectations	2013-10-11 06:16:23 UTC (rev 157290)
@@ -2381,6 +2381,7 @@
 media/video-controls-captions-trackmenu-hide-on-click-outside.html
 media/video-controls-visible-exiting-fullscreen.html
 media/video-controls-captions-trackmenu-includes-enabled-track.html
+media/video-controls-captions-trackmenu-only-captions-descriptions-and-subtitles.html
 
 # Fails on JSC platforms due to gc timing issues
 # https://bugs.webkit.org/show_bug.cgi?id=106957

Modified: trunk/Source/WebCore/ChangeLog (157289 => 157290)


--- trunk/Source/WebCore/ChangeLog	2013-10-11 04:55:47 UTC (rev 157289)
+++ trunk/Source/WebCore/ChangeLog	2013-10-11 06:16:23 UTC (rev 157290)
@@ -1,3 +1,15 @@
+2013-10-10  Brendan Long  <[email protected]>
+
+        Track controls show metadata and chapter tracks
+        https://bugs.webkit.org/show_bug.cgi?id=122468
+
+        Reviewed by Darin Adler.
+
+        Test: media/video-controls-captions-trackmenu-only-captions-descriptions-and-subtitles.html
+
+        * page/CaptionUserPreferences.cpp:
+        (WebCore::CaptionUserPreferences::sortedTrackListForMenu): Only show captions, descriptions and subtitles in the track controls.
+
 2013-10-10  Ryosuke Niwa  <[email protected]>
 
         EventContext should be used only in EventDispatcher.cpp

Modified: trunk/Source/WebCore/page/CaptionUserPreferences.cpp (157289 => 157290)


--- trunk/Source/WebCore/page/CaptionUserPreferences.cpp	2013-10-11 04:55:47 UTC (rev 157289)
+++ trunk/Source/WebCore/page/CaptionUserPreferences.cpp	2013-10-11 06:16:23 UTC (rev 157290)
@@ -179,8 +179,12 @@
 
     Vector<RefPtr<TextTrack>> tracksForMenu;
 
-    for (unsigned i = 0, length = trackList->length(); i < length; ++i)
-        tracksForMenu.append(trackList->item(i));
+    for (unsigned i = 0, length = trackList->length(); i < length; ++i) {
+        TextTrack* track = trackList->item(i);
+        const AtomicString& kind = track->kind();
+        if (kind == TextTrack::captionsKeyword() || kind == TextTrack::descriptionsKeyword() || kind == TextTrack::subtitlesKeyword())
+            tracksForMenu.append(track);
+    }
 
     std::sort(tracksForMenu.begin(), tracksForMenu.end(), [](const RefPtr<TextTrack>& a, const RefPtr<TextTrack>& b) {
         return codePointCompare(trackDisplayName(a.get()), trackDisplayName(b.get())) < 0;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to