Title: [212942] trunk
Revision
212942
Author
[email protected]
Date
2017-02-23 21:41:22 -0800 (Thu, 23 Feb 2017)

Log Message

[Modern Media Controls] Dragging controls in fullscreen on macOS prevents scrubbing or interacting with controls
https://bugs.webkit.org/show_bug.cgi?id=168820
<rdar://problem/30690281>

Patch by Antoine Quint <[email protected]> on 2017-02-23
Reviewed by Jon Lee.

Source/WebCore:

We broke this in https://bugs.webkit.org/show_bug.cgi?id=168755. We restore the check that the
event target when initiating a drag is the controls bar itself and not some of its content.

Since this wasn't caught by our existing tests, we add a test that attemps to initiate a drag
starting over one of the controls and notice that no dragging occurs.

Test: media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button.html

* Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
(MacOSFullscreenMediaControls.prototype._handleMousedown):

LayoutTests:

Making the existing test more robust and adding a new test that checks what happens
when we initiate a drag over some controls.

* media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-expected.txt:
* media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button-expected.txt: Added.
* media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button.html: Added.
* media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag.html:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (212941 => 212942)


--- trunk/LayoutTests/ChangeLog	2017-02-24 05:33:40 UTC (rev 212941)
+++ trunk/LayoutTests/ChangeLog	2017-02-24 05:41:22 UTC (rev 212942)
@@ -1,3 +1,19 @@
+2017-02-23  Antoine Quint  <[email protected]>
+
+        [Modern Media Controls] Dragging controls in fullscreen on macOS prevents scrubbing or interacting with controls
+        https://bugs.webkit.org/show_bug.cgi?id=168820
+        <rdar://problem/30690281>
+
+        Reviewed by Jon Lee.
+
+        Making the existing test more robust and adding a new test that checks what happens
+        when we initiate a drag over some controls.
+
+        * media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-expected.txt:
+        * media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button-expected.txt: Added.
+        * media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button.html: Added.
+        * media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag.html:
+
 2017-02-23  Simon Fraser  <[email protected]>
 
         REGRESSION (r211305): Masks on composited elements with preserve-3d broken

Modified: trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-expected.txt (212941 => 212942)


--- trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-expected.txt	2017-02-24 05:33:40 UTC (rev 212941)
+++ trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-expected.txt	2017-02-24 05:41:22 UTC (rev 212942)
@@ -1,8 +1,10 @@
-Testing the MediaController resizing behavior.
+This test pauses the video, presses the fullscreen button, and drags the controls when the mouse is over a button. It should follow the mouse drag.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+PASS !!mediaControls.querySelector('.buttons-container.left') became true
+PASS mediaControls.querySelector('.buttons-container.left').style.width became "116px"
 PASS mediaControls.querySelector('.controls-bar').style.transform is "translate(-50px, -100px)"
 PASS successfullyParsed is true
 

Added: trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button-expected.txt (0 => 212942)


--- trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button-expected.txt	2017-02-24 05:41:22 UTC (rev 212942)
@@ -0,0 +1,12 @@
+This test pauses the video, presses the fullscreen button, and drags the controls when the mouse is over a button. It should not move.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS !!mediaControls.querySelector('.buttons-container.left') became true
+PASS mediaControls.querySelector('.buttons-container.left').style.width became "116px"
+PASS mediaControls.querySelector('.controls-bar').style.transform is ""
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button.html (from rev 212941, trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag.html) (0 => 212942)


--- trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button.html	                        (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button.html	2017-02-24 05:41:22 UTC (rev 212942)
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<script src=""
+<body>
+<video src="" style="width: 320px; height: 240px;" controls autoplay></video>
+<script type="text/_javascript_">
+
+window.jsTestIsAsync = true;
+
+description("This test pauses the video, presses the fullscreen button, and drags the controls when the mouse is over a button. It should not move.");
+
+const media = document.querySelector("video");
+const shadowRoot = window.internals.shadowRoot(media);
+let mediaControls = shadowRoot.lastChild;
+
+media.addEventListener("webkitbeginfullscreen", () => {
+    debug("webkitbeginfullscreen");
+});
+
+media.addEventListener("webkitfullscreenchange", () => {
+    if (media.webkitDisplayingFullscreen) {
+        mediaControls = shadowRoot.lastChild;
+        shouldBecomeEqual("!!mediaControls.querySelector('.buttons-container.left')", "true", () => {
+            shouldBecomeEqualToString("mediaControls.querySelector('.buttons-container.left').style.width", "116px", () => {
+                const bounds = mediaControls.querySelector(".controls-bar").getBoundingClientRect();
+                eventSender.mouseMoveTo(bounds.left + 68, bounds.top + 10);
+                eventSender.mouseDown();
+                eventSender.mouseMoveTo(bounds.left + 18, bounds.top - 90);
+                eventSender.mouseUp();
+
+                window.requestAnimationFrame(() => {
+                    shouldBeEqualToString("mediaControls.querySelector('.controls-bar').style.transform", "");
+                    finishJSTest();
+                });
+            });
+        });
+    }
+});
+
+media.addEventListener("play", () => {
+    media.pause();
+
+    window.requestAnimationFrame(() => {
+        const bounds = mediaControls.querySelector("button.fullscreen").getBoundingClientRect();
+        eventSender.mouseMoveTo(bounds.left + 1, bounds.top + 1);
+        eventSender.mouseDown();
+        eventSender.mouseUp();
+    });
+});
+
+</script>
+<script src=""
+</body>

Modified: trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag.html (212941 => 212942)


--- trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag.html	2017-02-24 05:33:40 UTC (rev 212941)
+++ trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag.html	2017-02-24 05:41:22 UTC (rev 212942)
@@ -6,7 +6,7 @@
 
 window.jsTestIsAsync = true;
 
-description("Testing the <code>MediaController</code> resizing behavior.");
+description("This test pauses the video, presses the fullscreen button, and drags the controls when the mouse is over a button. It should follow the mouse drag.");
 
 const media = document.querySelector("video");
 const shadowRoot = window.internals.shadowRoot(media);
@@ -19,16 +19,18 @@
 media.addEventListener("webkitfullscreenchange", () => {
     if (media.webkitDisplayingFullscreen) {
         mediaControls = shadowRoot.lastChild;
-        window.requestAnimationFrame(() => {
-            const bounds = mediaControls.querySelector(".controls-bar").getBoundingClientRect();
-            eventSender.mouseMoveTo(bounds.left + 118, bounds.top + 10);
-            eventSender.mouseDown();
-            eventSender.mouseMoveTo(bounds.left + 68, bounds.top - 90);
-            eventSender.mouseUp();
+        shouldBecomeEqual("!!mediaControls.querySelector('.buttons-container.left')", "true", () => {
+            shouldBecomeEqualToString("mediaControls.querySelector('.buttons-container.left').style.width", "116px", () => {
+                const bounds = mediaControls.querySelector(".controls-bar").getBoundingClientRect();
+                eventSender.mouseMoveTo(bounds.left + 118, bounds.top + 10);
+                eventSender.mouseDown();
+                eventSender.mouseMoveTo(bounds.left + 68, bounds.top - 90);
+                eventSender.mouseUp();
 
-            window.requestAnimationFrame(() => {
-                shouldBeEqualToString("mediaControls.querySelector('.controls-bar').style.transform", "translate(-50px, -100px)");
-                finishJSTest();
+                window.requestAnimationFrame(() => {
+                    shouldBeEqualToString("mediaControls.querySelector('.controls-bar').style.transform", "translate(-50px, -100px)");
+                    finishJSTest();
+                });
             });
         });
     }

Modified: trunk/Source/WebCore/ChangeLog (212941 => 212942)


--- trunk/Source/WebCore/ChangeLog	2017-02-24 05:33:40 UTC (rev 212941)
+++ trunk/Source/WebCore/ChangeLog	2017-02-24 05:41:22 UTC (rev 212942)
@@ -1,3 +1,22 @@
+2017-02-23  Antoine Quint  <[email protected]>
+
+        [Modern Media Controls] Dragging controls in fullscreen on macOS prevents scrubbing or interacting with controls
+        https://bugs.webkit.org/show_bug.cgi?id=168820
+        <rdar://problem/30690281>
+
+        Reviewed by Jon Lee.
+
+        We broke this in https://bugs.webkit.org/show_bug.cgi?id=168755. We restore the check that the
+        event target when initiating a drag is the controls bar itself and not some of its content.
+
+        Since this wasn't caught by our existing tests, we add a test that attemps to initiate a drag
+        starting over one of the controls and notice that no dragging occurs.
+
+        Test: media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button.html
+
+        * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
+        (MacOSFullscreenMediaControls.prototype._handleMousedown):
+
 2017-02-23  Simon Fraser  <[email protected]>
 
         REGRESSION (r211305): Masks on composited elements with preserve-3d broken

Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js (212941 => 212942)


--- trunk/Source/WebCore/Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js	2017-02-24 05:33:40 UTC (rev 212941)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js	2017-02-24 05:41:22 UTC (rev 212942)
@@ -125,6 +125,9 @@
 
     _handleMousedown(event)
     {
+        if (event.target !== this.controlsBar.element)
+            return;
+
         event.preventDefault();
         event.stopPropagation();
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to