Title: [201883] trunk
- Revision
- 201883
- Author
- [email protected]
- Date
- 2016-06-09 14:30:35 -0700 (Thu, 09 Jun 2016)
Log Message
Don't show the caption menu if a video has only forced tracks
https://bugs.webkit.org/show_bug.cgi?id=158573
<rdar://problem/24632384>
Reviewed by Jer Noble.
Source/WebCore:
Test: media/controls/forced-tracks-only.html
* Modules/mediacontrols/mediaControlsApple.js:
(Controller.prototype.updateCaptionButton): Don't show the button of there are no user-selectable
text or audio tracks.
* page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::CaptionUserPreferencesMediaAF::sortedTrackListForMenu): Return an empty Vector if
there are no user-selectable tracks.
LayoutTests:
* media/controls/forced-tracks-only-expected.txt: Added.
* media/controls/forced-tracks-only.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (201882 => 201883)
--- trunk/LayoutTests/ChangeLog 2016-06-09 21:01:55 UTC (rev 201882)
+++ trunk/LayoutTests/ChangeLog 2016-06-09 21:30:35 UTC (rev 201883)
@@ -1,3 +1,14 @@
+2016-06-09 Eric Carlson <[email protected]>
+
+ Don't show the caption menu if a video has only forced tracks
+ https://bugs.webkit.org/show_bug.cgi?id=158573
+ <rdar://problem/24632384>
+
+ Reviewed by Jer Noble.
+
+ * media/controls/forced-tracks-only-expected.txt: Added.
+ * media/controls/forced-tracks-only.html: Added.
+
2016-06-09 Chris Dumez <[email protected]>
WorkerGlobalScope attributes / operations should be on the prototype
Added: trunk/LayoutTests/media/controls/forced-tracks-only-expected.txt (0 => 201883)
--- trunk/LayoutTests/media/controls/forced-tracks-only-expected.txt (rev 0)
+++ trunk/LayoutTests/media/controls/forced-tracks-only-expected.txt 2016-06-09 21:30:35 UTC (rev 201883)
@@ -0,0 +1,15 @@
+This verifies that the track menu is not visible when a file has only forced tracks.
+
+This test only runs in DRT!
+
+
+EVENT: canplaythrough
+PASS: We are using the apple idiom
+PASS: All text tracks accounted for
+PASS: Text track 1 not visible
+PASS: Text track 2 not visible
+PASS: Menu name is 'Track Menu'
+PASS: Menu does not exist
+
+Testing finished.
+
Added: trunk/LayoutTests/media/controls/forced-tracks-only.html (0 => 201883)
--- trunk/LayoutTests/media/controls/forced-tracks-only.html (rev 0)
+++ trunk/LayoutTests/media/controls/forced-tracks-only.html 2016-06-09 21:30:35 UTC (rev 201883)
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script src=""
+ <script src=""
+ <script src=""
+ <script src=""
+ <script src=""
+ <script>
+ var tester = new ControlsTest()
+ .whenReady(testSetup)
+ .start();
+
+ function testSetup()
+ {
+ findMediaElement();
+
+ var currentState = tester.currentState;
+ tester.test("We are using the apple idiom")
+ .value(currentState.idiom)
+ .isEqualTo("apple");
+
+ tester.test("All text tracks accounted for")
+ .value(tester.video.textTracks.length)
+ .isEqualTo("2");
+
+ tester.test("Text track 1 not visible")
+ .value(tester.video.textTracks[0].mode)
+ .isEqualTo("disabled");
+
+ tester.test("Text track 2 not visible")
+ .value(tester.video.textTracks[1].mode)
+ .isEqualTo("disabled");
+
+ var statusState = tester.stateForControlsElement("Track Menu", true);
+
+ tester.test("Menu name is 'Track Menu'")
+ .value(statusState.name)
+ .isEqualTo("Track Menu");
+
+ var captionMenu = getTrackListElement();
+ tester.test("Menu does not exist")
+ .value(captionMenu)
+ .isEqualTo(null);
+
+ tester.end();
+ }
+
+ </script>
+ </head>
+ <body>
+ <p>This verifies that the track menu is not visible when a file has only forced tracks.</p>
+ <p>This test only runs in DRT!</p>
+ <video width="500" height="300" controls>
+ <track label="z" kind="forced" src="" srclang="ja">
+ <track label="y" kind="forced" src="" srclang="en-au">
+ </video>
+ </body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (201882 => 201883)
--- trunk/Source/WebCore/ChangeLog 2016-06-09 21:01:55 UTC (rev 201882)
+++ trunk/Source/WebCore/ChangeLog 2016-06-09 21:30:35 UTC (rev 201883)
@@ -1,3 +1,21 @@
+2016-06-09 Eric Carlson <[email protected]>
+
+ Don't show the caption menu if a video has only forced tracks
+ https://bugs.webkit.org/show_bug.cgi?id=158573
+ <rdar://problem/24632384>
+
+ Reviewed by Jer Noble.
+
+ Test: media/controls/forced-tracks-only.html
+
+ * Modules/mediacontrols/mediaControlsApple.js:
+ (Controller.prototype.updateCaptionButton): Don't show the button of there are no user-selectable
+ text or audio tracks.
+
+ * page/CaptionUserPreferencesMediaAF.cpp:
+ (WebCore::CaptionUserPreferencesMediaAF::sortedTrackListForMenu): Return an empty Vector if
+ there are no user-selectable tracks.
+
2016-06-09 Jer Noble <[email protected]>
Pass through play state and toggle state to the WebPlaybackControlsManager
Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js (201882 => 201883)
--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js 2016-06-09 21:01:55 UTC (rev 201882)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js 2016-06-09 21:30:35 UTC (rev 201883)
@@ -1741,7 +1741,10 @@
updateCaptionButton: function()
{
- if (this.video.webkitHasClosedCaptions || this.video.audioTracks.length > 1)
+ var audioTracks = this.host.sortedTrackListForMenu(this.video.audioTracks);
+ var textTracks = this.host.sortedTrackListForMenu(this.video.textTracks);
+
+ if ((textTracks && textTracks.length) || (audioTracks && audioTracks.length > 1))
this.controls.captionButton.classList.remove(this.ClassNames.hidden);
else
this.controls.captionButton.classList.add(this.ClassNames.hidden);
Modified: trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp (201882 => 201883)
--- trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp 2016-06-09 21:01:55 UTC (rev 201882)
+++ trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp 2016-06-09 21:30:35 UTC (rev 201883)
@@ -944,6 +944,9 @@
}
}
+ if (tracksForMenu.isEmpty())
+ return tracksForMenu;
+
std::sort(tracksForMenu.begin(), tracksForMenu.end(), textTrackCompare);
tracksForMenu.insert(0, TextTrack::captionMenuOffItem());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes