Diff
Modified: trunk/LayoutTests/ChangeLog (285215 => 285216)
--- trunk/LayoutTests/ChangeLog 2021-11-03 17:47:09 UTC (rev 285215)
+++ trunk/LayoutTests/ChangeLog 2021-11-03 17:59:39 UTC (rev 285216)
@@ -1,3 +1,20 @@
+2021-11-03 Devin Rousso <drou...@apple.com>
+
+ [Modern Media Controls] should show tracks button/menu for <audio>
+ https://bugs.webkit.org/show_bug.cgi?id=232597
+
+ Reviewed by Eric Carlson.
+
+ * media/modern-media-controls/tracks-support/audio-multiple-tracks.html: Added.
+ * media/modern-media-controls/tracks-support/audio-multiple-tracks-expected.txt: Added.
+ * media/modern-media-controls/tracks-support/audio-single-track.html: Added.
+ * media/modern-media-controls/tracks-support/audio-single-track-expected.txt: Added.
+
+ * media/modern-media-controls/audio/audio-controls-buttons.html:
+ * media/modern-media-controls/audio/audio-controls-buttons-expected.txt:
+
+ * platform/ios-wk2/TestExpectations:
+
2021-11-03 Chris Dumez <cdu...@apple.com>
_javascript_ URLs do not run in the right context when using frame targeting
Modified: trunk/LayoutTests/media/modern-media-controls/audio/audio-controls-buttons-expected.txt (285215 => 285216)
--- trunk/LayoutTests/media/modern-media-controls/audio/audio-controls-buttons-expected.txt 2021-11-03 17:47:09 UTC (rev 285215)
+++ trunk/LayoutTests/media/modern-media-controls/audio/audio-controls-buttons-expected.txt 2021-11-03 17:59:39 UTC (rev 285216)
@@ -5,7 +5,7 @@
Making AirPlay routes available.
AirPlay routes became available.
-PASS mediaController.controls.rightContainer.children.length is 3
+PASS mediaController.controls.rightContainer.children.length is 4
PASS mediaController.controls.rightContainer.children[0] is mediaController.controls.muteButton
PASS mediaController.controls.rightContainer.children[1] is mediaController.controls.airplayButton
PASS accessibilityController.accessibleElementById('audio-controls').description is "AXDescription: Audio Controls"
Modified: trunk/LayoutTests/media/modern-media-controls/audio/audio-controls-buttons.html (285215 => 285216)
--- trunk/LayoutTests/media/modern-media-controls/audio/audio-controls-buttons.html 2021-11-03 17:47:09 UTC (rev 285215)
+++ trunk/LayoutTests/media/modern-media-controls/audio/audio-controls-buttons.html 2021-11-03 17:59:39 UTC (rev 285216)
@@ -42,7 +42,7 @@
debug("AirPlay routes became available.");
media.removeEventListener('webkitplaybacktargetavailabilitychanged', playbackTargetAvailabilityChangedAgain, true);
- shouldBe("mediaController.controls.rightContainer.children.length", "3");
+ shouldBe("mediaController.controls.rightContainer.children.length", "4");
shouldBe("mediaController.controls.rightContainer.children[0]", "mediaController.controls.muteButton");
shouldBe("mediaController.controls.rightContainer.children[1]", "mediaController.controls.airplayButton");
mediaController.controls.bottomControlsBar.element.setAttribute("id", "audio-controls");
Added: trunk/LayoutTests/media/modern-media-controls/tracks-support/audio-multiple-tracks-expected.txt (0 => 285216)
--- trunk/LayoutTests/media/modern-media-controls/tracks-support/audio-multiple-tracks-expected.txt (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/tracks-support/audio-multiple-tracks-expected.txt 2021-11-03 17:59:39 UTC (rev 285216)
@@ -0,0 +1,19 @@
+Check that the tracks button is shown if there's more than one audio track.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS shadowRoot.querySelector('button.overflow') became different from null
+PASS shadowRoot.querySelector('button.overflow').getBoundingClientRect().width became different from 0
+Tapping overflow button...
+PASS contextmenu.some((item) => item.title === 'Playback Speed') is true
+Dismissing contextmenu...
+PASS shadowRoot.querySelector('button.tracks') became different from null
+PASS shadowRoot.querySelector('button.tracks').getBoundingClientRect().width became different from 0
+Tapping tracks button...
+PASS contextmenu.some((item) => item.title === 'Languages') is true
+Dismissing contextmenu...
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/media/modern-media-controls/tracks-support/audio-multiple-tracks.html (0 => 285216)
--- trunk/LayoutTests/media/modern-media-controls/tracks-support/audio-multiple-tracks.html (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/tracks-support/audio-multiple-tracks.html 2021-11-03 17:59:39 UTC (rev 285216)
@@ -0,0 +1,66 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<meta name="viewport" content="width=device-width">
+<script src=""
+<script src=""
+<script src=""
+<body>
+<audio src="" style="position: absolute; left: 0; top: 0; width: 600px;" controls></audio>
+<script type="text/_javascript_">
+
+window.jsTestIsAsync = true;
+
+description("Check that the tracks button is shown if there's more than one audio track.");
+
+const media = document.querySelector("audio");
+const shadowRoot = window.internals.shadowRoot(media);
+
+window.internals.setMediaControlsMaximumRightContainerButtonCountOverride(media, 100); // A finite value larger than anything likely.
+
+let contextmenu = null;
+
+media.addEventListener("canplay", async () => {
+ await shouldBecomeDifferent("shadowRoot.querySelector('button.overflow')", "null");
+ await shouldBecomeDifferent("shadowRoot.querySelector('button.overflow').getBoundingClientRect().width", "0");
+
+ debug("Tapping overflow button...");
+ await pressOnElement(shadowRoot.querySelector("button.overflow"));
+ contextmenu = await getTracksContextMenu();
+ if (contextmenu.length === 1 && !contextmenu[0].title && contextmenu[0].children?.length)
+ contextmenu = contextmenu[0].children;
+ shouldBeTrue("contextmenu.some((item) => item.title === 'Playback Speed')");
+
+ debug("Dismissing contextmenu...");
+ await new Promise((resolve, reject) => {
+ testRunner.runUIScript(`
+ uiController.dismissMenu();
+ uiController.uiScriptComplete();
+ `, resolve);
+ });
+ await UIHelper.waitForContextMenuToHide();
+
+ await shouldBecomeDifferent("shadowRoot.querySelector('button.tracks')", "null");
+ await shouldBecomeDifferent("shadowRoot.querySelector('button.tracks').getBoundingClientRect().width", "0");
+
+ debug("Tapping tracks button...");
+ await pressOnElement(shadowRoot.querySelector("button.tracks"));
+ contextmenu = await getTracksContextMenu();
+ if (contextmenu.length === 1 && !contextmenu[0].title && contextmenu[0].children?.length)
+ contextmenu = contextmenu[0].children;
+ shouldBeTrue("contextmenu.some((item) => item.title === 'Languages')");
+
+ debug("Dismissing contextmenu...");
+ await new Promise((resolve, reject) => {
+ testRunner.runUIScript(`
+ uiController.dismissMenu();
+ uiController.uiScriptComplete();
+ `, resolve);
+ });
+ await UIHelper.waitForContextMenuToHide();
+
+ media.remove();
+ finishJSTest();
+});
+
+</script>
+<script src=""
+</body>
Added: trunk/LayoutTests/media/modern-media-controls/tracks-support/audio-single-track-expected.txt (0 => 285216)
--- trunk/LayoutTests/media/modern-media-controls/tracks-support/audio-single-track-expected.txt (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/tracks-support/audio-single-track-expected.txt 2021-11-03 17:59:39 UTC (rev 285216)
@@ -0,0 +1,16 @@
+Check that no tracks button is shown when there's only one audio track.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS shadowRoot.querySelector('button.overflow') became different from null
+PASS shadowRoot.querySelector('button.overflow').getBoundingClientRect().width became different from 0
+Tapping overflow button...
+PASS contextmenu.some((item) => item.title === 'Playback Speed') is true
+Dismissing contextmenu...
+PASS shadowRoot.querySelector('button.tracks') became different from null
+PASS shadowRoot.querySelector('button.tracks').getBoundingClientRect().width became 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/media/modern-media-controls/tracks-support/audio-single-track.html (0 => 285216)
--- trunk/LayoutTests/media/modern-media-controls/tracks-support/audio-single-track.html (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/tracks-support/audio-single-track.html 2021-11-03 17:59:39 UTC (rev 285216)
@@ -0,0 +1,50 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<meta name="viewport" content="width=device-width">
+<script src=""
+<script src=""
+<script src=""
+<body>
+<audio src="" style="position: absolute; left: 0; top: 0; width: 600px;" controls></audio>
+<script type="text/_javascript_">
+
+window.jsTestIsAsync = true;
+
+description("Check that no tracks button is shown when there's only one audio track.");
+
+const media = document.querySelector("audio");
+const shadowRoot = window.internals.shadowRoot(media);
+
+window.internals.setMediaControlsMaximumRightContainerButtonCountOverride(media, 100); // A finite value larger than anything likely.
+
+let contextmenu = null;
+
+media.addEventListener("canplay", async () => {
+ await shouldBecomeDifferent("shadowRoot.querySelector('button.overflow')", "null");
+ await shouldBecomeDifferent("shadowRoot.querySelector('button.overflow').getBoundingClientRect().width", "0");
+
+ debug("Tapping overflow button...");
+ await pressOnElement(shadowRoot.querySelector("button.overflow"));
+ contextmenu = await getTracksContextMenu();
+ if (contextmenu.length === 1 && !contextmenu[0].title && contextmenu[0].children?.length)
+ contextmenu = contextmenu[0].children;
+ shouldBeTrue("contextmenu.some((item) => item.title === 'Playback Speed')");
+
+ debug("Dismissing contextmenu...");
+ await new Promise((resolve, reject) => {
+ testRunner.runUIScript(`
+ uiController.dismissMenu();
+ uiController.uiScriptComplete();
+ `, resolve);
+ });
+ await UIHelper.waitForContextMenuToHide();
+
+ await shouldBecomeDifferent("shadowRoot.querySelector('button.tracks')", "null");
+ await shouldBecomeEqual("shadowRoot.querySelector('button.tracks').getBoundingClientRect().width", "0");
+
+ media.remove();
+ finishJSTest();
+});
+
+</script>
+<script src=""
+</body>
Modified: trunk/LayoutTests/platform/ios-wk2/TestExpectations (285215 => 285216)
--- trunk/LayoutTests/platform/ios-wk2/TestExpectations 2021-11-03 17:47:09 UTC (rev 285215)
+++ trunk/LayoutTests/platform/ios-wk2/TestExpectations 2021-11-03 17:59:39 UTC (rev 285216)
@@ -68,6 +68,8 @@
webkit.org/b/231187 media/modern-media-controls/tracks-support/hidden-tracks.html [ Timeout ]
webkit.org/b/231187 media/modern-media-controls/tracks-support/click-track-in-contextmenu.html [ Timeout ]
webkit.org/b/231187 media/modern-media-controls/tracks-support/auto-text-track.html [ Timeout ]
+webkit.org/b/231187 media/modern-media-controls/tracks-support/audio-multiple-tracks.html [ Timeout ]
+webkit.org/b/231187 media/modern-media-controls/tracks-support/audio-single-track.html [ Timeout ]
fast/images/text-recognition [ Pass ]
fast/images/text-recognition/ios [ Pass ]
Modified: trunk/Source/WebCore/ChangeLog (285215 => 285216)
--- trunk/Source/WebCore/ChangeLog 2021-11-03 17:47:09 UTC (rev 285215)
+++ trunk/Source/WebCore/ChangeLog 2021-11-03 17:59:39 UTC (rev 285216)
@@ -1,3 +1,19 @@
+2021-11-03 Devin Rousso <drou...@apple.com>
+
+ [Modern Media Controls] should show tracks button/menu for <audio>
+ https://bugs.webkit.org/show_bug.cgi?id=232597
+
+ Reviewed by Eric Carlson.
+
+ There's nothing preventing `<audio>` from having multiple `<source>`. We should have a
+ language picker for `<audio>` just like what we have for `<video>`.
+
+ Tests: media/modern-media-controls/tracks-support/audio-multiple-tracks.html
+ media/modern-media-controls/tracks-support/audio-single-track.html
+
+ * Modules/modern-media-controls/controls/inline-media-controls.js:
+ (InlineMediaControls.prototype._rightContainerButtons):
+
2021-11-03 Chris Dumez <cdu...@apple.com>
_javascript_ URLs do not run in the right context when using frame targeting
Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/inline-media-controls.js (285215 => 285216)
--- trunk/Source/WebCore/Modules/modern-media-controls/controls/inline-media-controls.js 2021-11-03 17:47:09 UTC (rev 285215)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/inline-media-controls.js 2021-11-03 17:59:39 UTC (rev 285216)
@@ -268,7 +268,7 @@
_rightContainerButtons()
{
if (this._shouldUseAudioLayout)
- return [this.muteButton, this.airplayButton, this.overflowButton];
+ return [this.muteButton, this.airplayButton, this.tracksButton, this.overflowButton];
if (this._shouldUseSingleBarLayout)
return [this.muteButton, this.airplayButton, this.pipButton, this.tracksButton, this.fullscreenButton, this.overflowButton];