Title: [212571] trunk
- Revision
- 212571
- Author
- grao...@webkit.org
- Date
- 2017-02-17 13:32:10 -0800 (Fri, 17 Feb 2017)
Log Message
REGRESSION: Subtitles menu in media controls allows multiple items to be selected
https://bugs.webkit.org/show_bug.cgi?id=168168
<rdar://problem/30488605>
Reviewed by Dean Jackson.
Source/WebCore:
Ensure that only a single audio track and a single text track can be selected
in the tracks panel at any given point.
* Modules/modern-media-controls/media/tracks-support.js:
(TracksSupport.prototype.tracksPanelSelectionDidChange):
(TracksSupport.prototype._sortedTrackList):
(TracksSupport):
LayoutTests:
Enhance the interactive track selection test to select a second track and check
that only a single track is selected at once.
* media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel-expected.txt:
* media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (212570 => 212571)
--- trunk/LayoutTests/ChangeLog 2017-02-17 21:30:15 UTC (rev 212570)
+++ trunk/LayoutTests/ChangeLog 2017-02-17 21:32:10 UTC (rev 212571)
@@ -1,3 +1,17 @@
+2017-02-17 Antoine Quint <grao...@apple.com>
+
+ REGRESSION: Subtitles menu in media controls allows multiple items to be selected
+ https://bugs.webkit.org/show_bug.cgi?id=168168
+ <rdar://problem/30488605>
+
+ Reviewed by Dean Jackson.
+
+ Enhance the interactive track selection test to select a second track and check
+ that only a single track is selected at once.
+
+ * media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel-expected.txt:
+ * media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html:
+
2017-02-17 Ryan Haddad <ryanhad...@apple.com>
Update TestExpectations for fast/css/appearance-apple-pay-button.html.
Modified: trunk/LayoutTests/media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel-expected.txt (212570 => 212571)
--- trunk/LayoutTests/media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel-expected.txt 2017-02-17 21:30:15 UTC (rev 212570)
+++ trunk/LayoutTests/media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel-expected.txt 2017-02-17 21:32:10 UTC (rev 212571)
@@ -3,13 +3,26 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS media.audioTracks[1].enabled is false
+media.audioTracks[0].enabled = true
+media.audioTracks[1].enabled = false
+media.audioTracks[2].enabled = false
Clicking on the tracks button
Clicking on second audio track in tracks panel
+
Obtained change event on media audio tracks
-PASS media.audioTracks[1].enabled is true
+media.audioTracks[0].enabled = false
+media.audioTracks[1].enabled = true
+media.audioTracks[2].enabled = false
+Clicking on the tracks button
+Clicking on third audio track in tracks panel
+
+Obtained change event on media audio tracks
+media.audioTracks[0].enabled = false
+media.audioTracks[1].enabled = false
+media.audioTracks[2].enabled = true
+
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html (212570 => 212571)
--- trunk/LayoutTests/media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html 2017-02-17 21:30:15 UTC (rev 212570)
+++ trunk/LayoutTests/media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html 2017-02-17 21:32:10 UTC (rev 212571)
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<script src=""
<body>
-<video src="" style="width: 640px; height: 360px;" controls autoplay></video>
+<video src="" style="position: absolute; left: 0; top: 0; width: 640px; height: 360px;" controls autoplay></video>
<script type="text/_javascript_">
window.jsTestIsAsync = true;
@@ -11,33 +11,47 @@
const media = document.querySelector("video");
const shadowRoot = window.internals.shadowRoot(media);
+let previouslySelectedTrack = 0;
+
media.addEventListener("play", () => {
media.pause();
- shouldBeFalse("media.audioTracks[1].enabled");
- debug("");
+ dumpAudioTracksEnabledState();
media.audioTracks.addEventListener("change", audioTracksDidChange);
- window.requestAnimationFrame(() => {
- clickOnTracksButton();
- window.requestAnimationFrame(clickOnSecondAudioTrack);
- });
+ clickOnTracksButton(clickOnSecondAudioTrack);
});
-function clickOnTracksButton()
+function clickOnTracksButton(continuation)
{
- debug("Clicking on the tracks button");
- const bounds = shadowRoot.lastChild.querySelector("button.tracks").getBoundingClientRect();
- eventSender.mouseMoveTo(bounds.left + 1, bounds.top + 1);
- eventSender.mouseDown();
- eventSender.mouseUp();
+ window.requestAnimationFrame(() => {
+ debug("");
+ debug("Clicking on the tracks button");
+ clickOnElement(shadowRoot.lastChild.querySelector("button.tracks"));
+ window.requestAnimationFrame(continuation);
+ });
}
function clickOnSecondAudioTrack()
{
debug("Clicking on second audio track in tracks panel");
- const secondAudioTrack = shadowRoot.lastChild.querySelectorAll("li")[1];
- const bounds = secondAudioTrack.getBoundingClientRect();
+ clickOnAudioTrackAtIndex(1);
+}
+
+function clickOnThirdAudioTrack()
+{
+ debug("Clicking on third audio track in tracks panel");
+ clickOnAudioTrackAtIndex(2);
+}
+
+function clickOnAudioTrackAtIndex(index)
+{
+ clickOnElement(shadowRoot.lastChild.querySelectorAll("li")[index]);
+}
+
+function clickOnElement(element)
+{
+ const bounds = element.getBoundingClientRect();
eventSender.mouseMoveTo(bounds.left + 1, bounds.top + 1);
eventSender.mouseDown();
eventSender.mouseUp();
@@ -45,14 +59,33 @@
function audioTracksDidChange()
{
+ const newSelectedTrack = Array.from(media.audioTracks).findIndex(track => track.enabled);
+ if (previouslySelectedTrack === newSelectedTrack)
+ return;
+
+ previouslySelectedTrack = newSelectedTrack;
+
+ debug("");
debug("Obtained change event on media audio tracks");
- shouldBeTrue("media.audioTracks[1].enabled");
- debug("");
- media.remove();
- finishJSTest();
+ dumpAudioTracksEnabledState();
+
+ if (media.audioTracks[1].enabled)
+ shadowRoot.lastChild.addEventListener("transitionend", event => clickOnTracksButton(clickOnThirdAudioTrack));
+ else if (media.audioTracks[2].enabled) {
+ debug("");
+ media.remove();
+ finishJSTest();
+ }
}
+function dumpAudioTracksEnabledState()
+{
+ Array.from(media.audioTracks).forEach((audioTrack, index) => {
+ debug(`media.audioTracks[${index}].enabled = ${media.audioTracks[index].enabled}`);
+ });
+}
+
</script>
<script src=""
</body>
Modified: trunk/Source/WebCore/ChangeLog (212570 => 212571)
--- trunk/Source/WebCore/ChangeLog 2017-02-17 21:30:15 UTC (rev 212570)
+++ trunk/Source/WebCore/ChangeLog 2017-02-17 21:32:10 UTC (rev 212571)
@@ -1,3 +1,19 @@
+2017-02-17 Antoine Quint <grao...@apple.com>
+
+ REGRESSION: Subtitles menu in media controls allows multiple items to be selected
+ https://bugs.webkit.org/show_bug.cgi?id=168168
+ <rdar://problem/30488605>
+
+ Reviewed by Dean Jackson.
+
+ Ensure that only a single audio track and a single text track can be selected
+ in the tracks panel at any given point.
+
+ * Modules/modern-media-controls/media/tracks-support.js:
+ (TracksSupport.prototype.tracksPanelSelectionDidChange):
+ (TracksSupport.prototype._sortedTrackList):
+ (TracksSupport):
+
2017-02-17 Jeremy Jones <jere...@apple.com>
Invalidate WebAVSampleBufferStatusChangeListener when MediaPlayerPrivateMediaStreamAVFObjC is deallocated.
Modified: trunk/Source/WebCore/Modules/modern-media-controls/media/tracks-support.js (212570 => 212571)
--- trunk/Source/WebCore/Modules/modern-media-controls/media/tracks-support.js 2017-02-17 21:30:15 UTC (rev 212570)
+++ trunk/Source/WebCore/Modules/modern-media-controls/media/tracks-support.js 2017-02-17 21:32:10 UTC (rev 212571)
@@ -105,13 +105,10 @@
tracksPanelSelectionDidChange(trackIndex, sectionIndex)
{
- if (sectionIndex == 0 && this._canPickAudioTracks()) {
- let track = this._audioTracks()[trackIndex];
- track.enabled = !track.enabled;
- } else {
- let track = this._textTracks()[trackIndex];
- track.mode = track.mode === "disabled" ? "showing" : "disabled";
- }
+ if (sectionIndex == 0 && this._canPickAudioTracks())
+ this._audioTracks().forEach((audioTrack, index) => audioTrack.enabled = index === trackIndex);
+ else
+ this._textTracks().forEach((textTrack, index) => textTrack.mode = index === trackIndex ? "showing" : "disabled");
this.mediaController.controls.hideTracksPanel();
}
@@ -147,9 +144,7 @@
_sortedTrackList(tracks)
{
- if (this.mediaController.host)
- return this.mediaController.host.sortedTrackListForMenu(tracks);
- return tracks;
+ return Array.from(this.mediaController.host ? this.mediaController.host.sortedTrackListForMenu(tracks) : tracks);
}
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes