- Revision
- 214471
- Author
- [email protected]
- Date
- 2017-03-28 03:42:39 -0700 (Tue, 28 Mar 2017)
Log Message
REGRESSION: Double-clicking the captions button while the captions popover is open prevents the popover from being opened again
https://bugs.webkit.org/show_bug.cgi?id=170171
<rdar://problem/31095500>
Patch by Antoine Quint <[email protected]> on 2017-03-28
Reviewed by Dean Jackson.
Source/WebCore:
We used to consider that the tracks panel was presented as long as it had a parent, but since we were using for the animated
transition to complete before actually removing the panel from the node hierarchy, consecutive calls to hide then present
would fail to present the panel. We now use a private instance variable to track the presented state which is set immediately
as presentInParent() and hide() are called.
Test: media/modern-media-controls/tracks-support/tracks-support-show-panel-then-double-click-on-tracks-button.html
* Modules/modern-media-controls/controls/tracks-panel.js:
(TracksPanel.prototype.get presented):
(TracksPanel.prototype.presentInParent):
(TracksPanel.prototype.hide):
LayoutTests:
Adding a new test that runs the steps to reproduce the issue, and rebaselining an existing one now that
the "presented" property returns false immediately after calling hide() on the panel.
* media/modern-media-controls/tracks-panel/tracks-panel-hide-expected.txt:
* media/modern-media-controls/tracks-panel/tracks-panel-hide.html:
* media/modern-media-controls/tracks-support/tracks-support-show-panel-then-double-click-on-tracks-button-expected.txt: Added.
* media/modern-media-controls/tracks-support/tracks-support-show-panel-then-double-click-on-tracks-button.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (214470 => 214471)
--- trunk/LayoutTests/ChangeLog 2017-03-28 09:33:21 UTC (rev 214470)
+++ trunk/LayoutTests/ChangeLog 2017-03-28 10:42:39 UTC (rev 214471)
@@ -1,3 +1,19 @@
+2017-03-28 Antoine Quint <[email protected]>
+
+ REGRESSION: Double-clicking the captions button while the captions popover is open prevents the popover from being opened again
+ https://bugs.webkit.org/show_bug.cgi?id=170171
+ <rdar://problem/31095500>
+
+ Reviewed by Dean Jackson.
+
+ Adding a new test that runs the steps to reproduce the issue, and rebaselining an existing one now that
+ the "presented" property returns false immediately after calling hide() on the panel.
+
+ * media/modern-media-controls/tracks-panel/tracks-panel-hide-expected.txt:
+ * media/modern-media-controls/tracks-panel/tracks-panel-hide.html:
+ * media/modern-media-controls/tracks-support/tracks-support-show-panel-then-double-click-on-tracks-button-expected.txt: Added.
+ * media/modern-media-controls/tracks-support/tracks-support-show-panel-then-double-click-on-tracks-button.html: Added.
+
2017-03-28 Aaron Chu <[email protected]>
AX: Media controls should be able to be re-activated after faded away
Modified: trunk/LayoutTests/media/modern-media-controls/tracks-panel/tracks-panel-hide-expected.txt (214470 => 214471)
--- trunk/LayoutTests/media/modern-media-controls/tracks-panel/tracks-panel-hide-expected.txt 2017-03-28 09:33:21 UTC (rev 214470)
+++ trunk/LayoutTests/media/modern-media-controls/tracks-panel/tracks-panel-hide-expected.txt 2017-03-28 10:42:39 UTC (rev 214471)
@@ -7,7 +7,7 @@
PASS tracksPanel.presented is true
tracksPanel.hide()
-PASS tracksPanel.presented is true
+PASS tracksPanel.presented is false
Transition ended
PASS tracksPanel.presented is false
Modified: trunk/LayoutTests/media/modern-media-controls/tracks-panel/tracks-panel-hide.html (214470 => 214471)
--- trunk/LayoutTests/media/modern-media-controls/tracks-panel/tracks-panel-hide.html 2017-03-28 09:33:21 UTC (rev 214470)
+++ trunk/LayoutTests/media/modern-media-controls/tracks-panel/tracks-panel-hide.html 2017-03-28 10:42:39 UTC (rev 214471)
@@ -23,7 +23,7 @@
debug("tracksPanel.hide()");
window.requestAnimationFrame(() => {
tracksPanel.hide();
- shouldBeTrue("tracksPanel.presented");
+ shouldBeFalse("tracksPanel.presented");
tracksPanel.element.addEventListener("transitionend", (event) => {
debug("");
debug("Transition ended");
Added: trunk/LayoutTests/media/modern-media-controls/tracks-support/tracks-support-show-panel-then-double-click-on-tracks-button-expected.txt (0 => 214471)
--- trunk/LayoutTests/media/modern-media-controls/tracks-support/tracks-support-show-panel-then-double-click-on-tracks-button-expected.txt (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/tracks-support/tracks-support-show-panel-then-double-click-on-tracks-button-expected.txt 2017-03-28 10:42:39 UTC (rev 214471)
@@ -0,0 +1,15 @@
+Ensure that double-clicking the tracks button when the tracks panel makes the panel appear again.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Media started playing
+PASS shadowRoot.querySelector('button.tracks') became different from null
+PASS shadowRoot.querySelector('button.tracks').getBoundingClientRect().width became different from 0
+PASS shadowRoot.querySelector('.tracks-panel') became different from null
+PASS shadowRoot.querySelector('.tracks-panel') is not null
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/media/modern-media-controls/tracks-support/tracks-support-show-panel-then-double-click-on-tracks-button.html (0 => 214471)
--- trunk/LayoutTests/media/modern-media-controls/tracks-support/tracks-support-show-panel-then-double-click-on-tracks-button.html (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/tracks-support/tracks-support-show-panel-then-double-click-on-tracks-button.html 2017-03-28 10:42:39 UTC (rev 214471)
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<script src=""
+<script src="" type="text/_javascript_"></script>
+<body>
+<video src="" style="position: absolute; left: 0; top: 0; width: 640px; height: 360px;" controls autoplay></video>
+<script type="text/_javascript_">
+
+window.jsTestIsAsync = true;
+
+description("Ensure that double-clicking the tracks button when the tracks panel makes the panel appear again.");
+
+const media = document.querySelector("video");
+const shadowRoot = window.internals.shadowRoot(media);
+
+media.addEventListener("play", () => {
+ media.pause();
+
+ debug("Media started playing");
+ shouldBecomeDifferent("shadowRoot.querySelector('button.tracks')", "null", () => {
+ shouldBecomeDifferent("shadowRoot.querySelector('button.tracks').getBoundingClientRect().width", "0", () => {
+ pressOnElement(shadowRoot.querySelector("button.tracks"));
+ shouldBecomeDifferent("shadowRoot.querySelector('.tracks-panel')", "null", () => {
+ pressOnElement(shadowRoot.querySelector("button.tracks"));
+ requestAnimationFrame(() => {
+ pressOnElement(shadowRoot.querySelector("button.tracks"));
+ // Give the transitionend event time to fire if it were to happen, which it should not.
+ setTimeout(() => {
+ shouldNotBe("shadowRoot.querySelector('.tracks-panel')", "null");
+ debug("");
+ media.remove();
+ finishJSTest();
+ }, 500);
+ });
+ });
+ });
+ });
+});
+
+</script>
+<script src=""
+</body>
Modified: trunk/Source/WebCore/ChangeLog (214470 => 214471)
--- trunk/Source/WebCore/ChangeLog 2017-03-28 09:33:21 UTC (rev 214470)
+++ trunk/Source/WebCore/ChangeLog 2017-03-28 10:42:39 UTC (rev 214471)
@@ -1,3 +1,23 @@
+2017-03-28 Antoine Quint <[email protected]>
+
+ REGRESSION: Double-clicking the captions button while the captions popover is open prevents the popover from being opened again
+ https://bugs.webkit.org/show_bug.cgi?id=170171
+ <rdar://problem/31095500>
+
+ Reviewed by Dean Jackson.
+
+ We used to consider that the tracks panel was presented as long as it had a parent, but since we were using for the animated
+ transition to complete before actually removing the panel from the node hierarchy, consecutive calls to hide then present
+ would fail to present the panel. We now use a private instance variable to track the presented state which is set immediately
+ as presentInParent() and hide() are called.
+
+ Test: media/modern-media-controls/tracks-support/tracks-support-show-panel-then-double-click-on-tracks-button.html
+
+ * Modules/modern-media-controls/controls/tracks-panel.js:
+ (TracksPanel.prototype.get presented):
+ (TracksPanel.prototype.presentInParent):
+ (TracksPanel.prototype.hide):
+
2017-03-28 Aaron Chu <[email protected]>
AX: Media controls should be able to be re-activated after faded away
Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/tracks-panel.js (214470 => 214471)
--- trunk/Source/WebCore/Modules/modern-media-controls/controls/tracks-panel.js 2017-03-28 09:33:21 UTC (rev 214470)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/tracks-panel.js 2017-03-28 10:42:39 UTC (rev 214471)
@@ -9,6 +9,7 @@
this._scrollableContainer = new LayoutNode(`<div class="scrollable-container"></div>`);
this._rightX = 0;
this._bottomY = 0;
+ this._presented = false;
this.children = [this._backgroundTint, this._scrollableContainer];
}
@@ -17,14 +18,16 @@
get presented()
{
- return !!this.parent;
+ return this._presented;
}
presentInParent(node)
{
- if (this.parent === node)
+ if (this._presented && this.parent === node)
return;
+ this._presented = true;
+
this._scrollableContainer.children = this._childrenFromDataSource();
node.addChild(this);
@@ -40,9 +43,11 @@
hide()
{
- if (!this.presented)
+ if (!this._presented)
return;
+ this._presented = false;
+
this._mousedownTarget().removeEventListener("mousedown", this, true);
window.removeEventListener("keydown", this, true);