<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[212942] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/212942">212942</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2017-02-23 21:41:22 -0800 (Thu, 23 Feb 2017)</dd>
</dl>

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

Patch by Antoine Quint &lt;graouts@apple.com&gt; 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:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsmediamodernmediacontrolsmacosfullscreenmediacontrolsmacosfullscreenmediacontrolsdragexpectedtxt">trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediamodernmediacontrolsmacosfullscreenmediacontrolsmacosfullscreenmediacontrolsdraghtml">trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesmodernmediacontrolscontrolsmacosfullscreenmediacontrolsjs">trunk/Source/WebCore/Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsmediamodernmediacontrolsmacosfullscreenmediacontrolsmacosfullscreenmediacontrolsdragispreventedoverbuttonexpectedtxt">trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediamodernmediacontrolsmacosfullscreenmediacontrolsmacosfullscreenmediacontrolsdragispreventedoverbuttonhtml">trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (212941 => 212942)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-02-24 05:33:40 UTC (rev 212941)
+++ trunk/LayoutTests/ChangeLog        2017-02-24 05:41:22 UTC (rev 212942)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2017-02-23  Antoine Quint  &lt;graouts@apple.com&gt;
+
+        [Modern Media Controls] Dragging controls in fullscreen on macOS prevents scrubbing or interacting with controls
+        https://bugs.webkit.org/show_bug.cgi?id=168820
+        &lt;rdar://problem/30690281&gt;
+
+        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:
+
</ins><span class="cx"> 2017-02-23  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION (r211305): Masks on composited elements with preserve-3d broken
</span></span></pre></div>
<a id="trunkLayoutTestsmediamodernmediacontrolsmacosfullscreenmediacontrolsmacosfullscreenmediacontrolsdragexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-expected.txt (212941 => 212942)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,8 +1,10 @@
</span><del>-Testing the MediaController resizing behavior.
</del><ins>+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.
</ins><span class="cx"> 
</span><span class="cx"> On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+PASS !!mediaControls.querySelector('.buttons-container.left') became true
+PASS mediaControls.querySelector('.buttons-container.left').style.width became &quot;116px&quot;
</ins><span class="cx"> PASS mediaControls.querySelector('.controls-bar').style.transform is &quot;translate(-50px, -100px)&quot;
</span><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsmediamodernmediacontrolsmacosfullscreenmediacontrolsmacosfullscreenmediacontrolsdragispreventedoverbuttonexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button-expected.txt (0 => 212942)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+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 &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS !!mediaControls.querySelector('.buttons-container.left') became true
+PASS mediaControls.querySelector('.buttons-container.left').style.width became &quot;116px&quot;
+PASS mediaControls.querySelector('.controls-bar').style.transform is &quot;&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsmediamodernmediacontrolsmacosfullscreenmediacontrolsmacosfullscreenmediacontrolsdragispreventedoverbuttonhtmlfromrev212941trunkLayoutTestsmediamodernmediacontrolsmacosfullscreenmediacontrolsmacosfullscreenmediacontrolsdraghtml"></a>
<div class="copfile"><h4>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)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,52 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;body&gt;
+&lt;video src=&quot;../../content/test.mp4&quot; style=&quot;width: 320px; height: 240px;&quot; controls autoplay&gt;&lt;/video&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+
+window.jsTestIsAsync = true;
+
+description(&quot;This test pauses the video, presses the fullscreen button, and drags the controls when the mouse is over a button. It should not move.&quot;);
+
+const media = document.querySelector(&quot;video&quot;);
+const shadowRoot = window.internals.shadowRoot(media);
+let mediaControls = shadowRoot.lastChild;
+
+media.addEventListener(&quot;webkitbeginfullscreen&quot;, () =&gt; {
+    debug(&quot;webkitbeginfullscreen&quot;);
+});
+
+media.addEventListener(&quot;webkitfullscreenchange&quot;, () =&gt; {
+    if (media.webkitDisplayingFullscreen) {
+        mediaControls = shadowRoot.lastChild;
+        shouldBecomeEqual(&quot;!!mediaControls.querySelector('.buttons-container.left')&quot;, &quot;true&quot;, () =&gt; {
+            shouldBecomeEqualToString(&quot;mediaControls.querySelector('.buttons-container.left').style.width&quot;, &quot;116px&quot;, () =&gt; {
+                const bounds = mediaControls.querySelector(&quot;.controls-bar&quot;).getBoundingClientRect();
+                eventSender.mouseMoveTo(bounds.left + 68, bounds.top + 10);
+                eventSender.mouseDown();
+                eventSender.mouseMoveTo(bounds.left + 18, bounds.top - 90);
+                eventSender.mouseUp();
+
+                window.requestAnimationFrame(() =&gt; {
+                    shouldBeEqualToString(&quot;mediaControls.querySelector('.controls-bar').style.transform&quot;, &quot;&quot;);
+                    finishJSTest();
+                });
+            });
+        });
+    }
+});
+
+media.addEventListener(&quot;play&quot;, () =&gt; {
+    media.pause();
+
+    window.requestAnimationFrame(() =&gt; {
+        const bounds = mediaControls.querySelector(&quot;button.fullscreen&quot;).getBoundingClientRect();
+        eventSender.mouseMoveTo(bounds.left + 1, bounds.top + 1);
+        eventSender.mouseDown();
+        eventSender.mouseUp();
+    });
+});
+
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsmediamodernmediacontrolsmacosfullscreenmediacontrolsmacosfullscreenmediacontrolsdraghtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag.html (212941 => 212942)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -6,7 +6,7 @@
</span><span class="cx"> 
</span><span class="cx"> window.jsTestIsAsync = true;
</span><span class="cx"> 
</span><del>-description(&quot;Testing the &lt;code&gt;MediaController&lt;/code&gt; resizing behavior.&quot;);
</del><ins>+description(&quot;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.&quot;);
</ins><span class="cx"> 
</span><span class="cx"> const media = document.querySelector(&quot;video&quot;);
</span><span class="cx"> const shadowRoot = window.internals.shadowRoot(media);
</span><span class="lines">@@ -19,16 +19,18 @@
</span><span class="cx"> media.addEventListener(&quot;webkitfullscreenchange&quot;, () =&gt; {
</span><span class="cx">     if (media.webkitDisplayingFullscreen) {
</span><span class="cx">         mediaControls = shadowRoot.lastChild;
</span><del>-        window.requestAnimationFrame(() =&gt; {
-            const bounds = mediaControls.querySelector(&quot;.controls-bar&quot;).getBoundingClientRect();
-            eventSender.mouseMoveTo(bounds.left + 118, bounds.top + 10);
-            eventSender.mouseDown();
-            eventSender.mouseMoveTo(bounds.left + 68, bounds.top - 90);
-            eventSender.mouseUp();
</del><ins>+        shouldBecomeEqual(&quot;!!mediaControls.querySelector('.buttons-container.left')&quot;, &quot;true&quot;, () =&gt; {
+            shouldBecomeEqualToString(&quot;mediaControls.querySelector('.buttons-container.left').style.width&quot;, &quot;116px&quot;, () =&gt; {
+                const bounds = mediaControls.querySelector(&quot;.controls-bar&quot;).getBoundingClientRect();
+                eventSender.mouseMoveTo(bounds.left + 118, bounds.top + 10);
+                eventSender.mouseDown();
+                eventSender.mouseMoveTo(bounds.left + 68, bounds.top - 90);
+                eventSender.mouseUp();
</ins><span class="cx"> 
</span><del>-            window.requestAnimationFrame(() =&gt; {
-                shouldBeEqualToString(&quot;mediaControls.querySelector('.controls-bar').style.transform&quot;, &quot;translate(-50px, -100px)&quot;);
-                finishJSTest();
</del><ins>+                window.requestAnimationFrame(() =&gt; {
+                    shouldBeEqualToString(&quot;mediaControls.querySelector('.controls-bar').style.transform&quot;, &quot;translate(-50px, -100px)&quot;);
+                    finishJSTest();
+                });
</ins><span class="cx">             });
</span><span class="cx">         });
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (212941 => 212942)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2017-02-23  Antoine Quint  &lt;graouts@apple.com&gt;
+
+        [Modern Media Controls] Dragging controls in fullscreen on macOS prevents scrubbing or interacting with controls
+        https://bugs.webkit.org/show_bug.cgi?id=168820
+        &lt;rdar://problem/30690281&gt;
+
+        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):
+
</ins><span class="cx"> 2017-02-23  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION (r211305): Masks on composited elements with preserve-3d broken
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmodernmediacontrolscontrolsmacosfullscreenmediacontrolsjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js (212941 => 212942)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -125,6 +125,9 @@
</span><span class="cx"> 
</span><span class="cx">     _handleMousedown(event)
</span><span class="cx">     {
</span><ins>+        if (event.target !== this.controlsBar.element)
+            return;
+
</ins><span class="cx">         event.preventDefault();
</span><span class="cx">         event.stopPropagation();
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>