<!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>[211576] branches/safari-604.1.5-branch</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/211576">211576</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2017-02-02 11:20:12 -0800 (Thu, 02 Feb 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/211339">r211339</a>. rdar://problem/29601646</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari60415branchLayoutTestsChangeLog">branches/safari-604.1.5-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari60415branchLayoutTestsplatformiossimulatorTestExpectations">branches/safari-604.1.5-branch/LayoutTests/platform/ios-simulator/TestExpectations</a></li>
<li><a href="#branchessafari60415branchSourceWebCoreChangeLog">branches/safari-604.1.5-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari60415branchSourceWebCoreModulesmodernmediacontrolsmediamediacontrollerjs">branches/safari-604.1.5-branch/Source/WebCore/Modules/modern-media-controls/media/media-controller.js</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari60415branchLayoutTestsmediamodernmediacontrolsmediadocumentsclickonvideoshouldnotpauseexpectedtxt">branches/safari-604.1.5-branch/LayoutTests/media/modern-media-controls/media-documents/click-on-video-should-not-pause-expected.txt</a></li>
<li><a href="#branchessafari60415branchLayoutTestsmediamodernmediacontrolsmediadocumentsclickonvideoshouldnotpausehtml">branches/safari-604.1.5-branch/LayoutTests/media/modern-media-controls/media-documents/click-on-video-should-not-pause.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari60415branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-604.1.5-branch/LayoutTests/ChangeLog (211575 => 211576)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-604.1.5-branch/LayoutTests/ChangeLog        2017-02-02 19:20:06 UTC (rev 211575)
+++ branches/safari-604.1.5-branch/LayoutTests/ChangeLog        2017-02-02 19:20:12 UTC (rev 211576)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2017-02-02  Matthew Hanson  &lt;matt_hanson@apple.com&gt;
+
+        Merge r211339. rdar://problem/29601646
+
+    2017-01-28  Antoine Quint  &lt;graouts@apple.com&gt;
+
+            [Modern Media Controls] REGRESSION: Video stops playing after going into Full Screen in media documents
+            https://bugs.webkit.org/show_bug.cgi?id=167552
+            &lt;rdar://problem/29601646&gt;
+
+            Reviewed by Eric Carlson.
+
+            Add a new test that checks that clicking on a &lt;video&gt; within a media document does not paused after being clicked.
+            Since this behavior uses click events, we use window.eventSender and skip this test on iOS.
+
+            * media/modern-media-controls/media-documents/click-on-video-should-not-pause-expected.txt: Added.
+            * media/modern-media-controls/media-documents/click-on-video-should-not-pause.html: Added.
+            * platform/ios-simulator/TestExpectations:
+
</ins><span class="cx"> 2017-01-26  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Crash when navigating back to a page in PacheCache when one of its frames has been removed
</span></span></pre></div>
<a id="branchessafari60415branchLayoutTestsmediamodernmediacontrolsmediadocumentsclickonvideoshouldnotpauseexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-604.1.5-branch/LayoutTests/media/modern-media-controls/media-documents/click-on-video-should-not-pause-expected.txt (0 => 211576)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-604.1.5-branch/LayoutTests/media/modern-media-controls/media-documents/click-on-video-should-not-pause-expected.txt                                (rev 0)
+++ branches/safari-604.1.5-branch/LayoutTests/media/modern-media-controls/media-documents/click-on-video-should-not-pause-expected.txt        2017-02-02 19:20:12 UTC (rev 211576)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+Testing that clicking on a video in a media document does not pause it.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS video.paused is false
+
+Clicking on video
+PASS video.paused is false
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="branchessafari60415branchLayoutTestsmediamodernmediacontrolsmediadocumentsclickonvideoshouldnotpausehtml"></a>
<div class="addfile"><h4>Added: branches/safari-604.1.5-branch/LayoutTests/media/modern-media-controls/media-documents/click-on-video-should-not-pause.html (0 => 211576)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-604.1.5-branch/LayoutTests/media/modern-media-controls/media-documents/click-on-video-should-not-pause.html                                (rev 0)
+++ branches/safari-604.1.5-branch/LayoutTests/media/modern-media-controls/media-documents/click-on-video-should-not-pause.html        2017-02-02 19:20:12 UTC (rev 211576)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/media-controls-loader.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
+&lt;body&gt;
+&lt;iframe src=&quot;../../content/test.mp4&quot; style=&quot;position: absolute; top: 0; left: 0;&quot;&gt;&lt;/iframe&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+
+description(&quot;Testing that clicking on a video in a media document does not pause it.&quot;);
+
+window.jsTestIsAsync = true;
+
+let video;
+(function runTestIfReady() {
+    const iframe = document.querySelector(&quot;iframe&quot;);
+    video = iframe.contentDocument.querySelector(&quot;video&quot;);
+
+    if (!video) {
+        setTimeout(runTestIfReady)
+        return;
+    }
+
+    if (!video.paused)
+        videoIsPlaying();
+    else
+        video.addEventListener(&quot;play&quot;, videoIsPlaying);    
+
+    function videoIsPlaying()
+    {
+        shouldBeFalse(&quot;video.paused&quot;);
+        
+        const bounds = video.getBoundingClientRect();
+        debug(&quot;&quot;);
+        debug(&quot;Clicking on video&quot;);
+        window.eventSender.mouseMoveTo(bounds.left + 10, bounds.top + 10);
+        window.eventSender.mouseDown();
+        window.eventSender.mouseUp();
+
+        shouldBeFalse(&quot;video.paused&quot;);
+
+        debug(&quot;&quot;);
+        iframe.remove();
+        finishJSTest();
+    }
+
+})();
+
+&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="branchessafari60415branchLayoutTestsplatformiossimulatorTestExpectations"></a>
<div class="modfile"><h4>Modified: branches/safari-604.1.5-branch/LayoutTests/platform/ios-simulator/TestExpectations (211575 => 211576)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-604.1.5-branch/LayoutTests/platform/ios-simulator/TestExpectations        2017-02-02 19:20:06 UTC (rev 211575)
+++ branches/safari-604.1.5-branch/LayoutTests/platform/ios-simulator/TestExpectations        2017-02-02 19:20:12 UTC (rev 211576)
</span><span class="lines">@@ -2800,6 +2800,7 @@
</span><span class="cx"> media/modern-media-controls/media-controller/media-controller-auto-hide-mouse-enter-over-controls-bar.html [ Skip ]
</span><span class="cx"> media/modern-media-controls/media-controller/media-controller-auto-hide-rewind-with-mouse-enter.html [ Skip ]
</span><span class="cx"> media/modern-media-controls/scrubber-support/scrubber-support-click.html [ Skip ]
</span><ins>+media/modern-media-controls/media-documents/click-on-video-should-not-pause.html [ Skip ]
</ins><span class="cx"> 
</span><span class="cx"> # Tests designed for macOS that have iOS equivalents in &quot;ipad&quot; directories
</span><span class="cx"> media/modern-media-controls/fullscreen-support/fullscreen-support-click.html [ Skip ]
</span></span></pre></div>
<a id="branchessafari60415branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-604.1.5-branch/Source/WebCore/ChangeLog (211575 => 211576)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-604.1.5-branch/Source/WebCore/ChangeLog        2017-02-02 19:20:06 UTC (rev 211575)
+++ branches/safari-604.1.5-branch/Source/WebCore/ChangeLog        2017-02-02 19:20:12 UTC (rev 211576)
</span><span class="lines">@@ -1,5 +1,28 @@
</span><span class="cx"> 2017-02-02  Matthew Hanson  &lt;matt_hanson@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r211339. rdar://problem/29601646
+
+    2017-01-28  Antoine Quint  &lt;graouts@apple.com&gt;
+
+            [Modern Media Controls] REGRESSION: Video stops playing after going into Full Screen in media documents
+            https://bugs.webkit.org/show_bug.cgi?id=167552
+            &lt;rdar://problem/29601646&gt;
+
+            Reviewed by Eric Carlson.
+
+            In the case of media documents, there is a built-in behavior, implemented in MediaDocument::defaultEventHandler(),
+            that toggles playback when clicking or double-clicking the video. We disable this behavior by adding a &quot;click&quot; event
+            handler on the entire media shadow root and calling &quot;preventDefault()&quot;.
+
+            Test: media/modern-media-controls/media-documents/click-on-video-should-not-pause.html
+
+            * Modules/modern-media-controls/media/media-controller.js:
+            (MediaController):
+            (MediaController.prototype.handleEvent):
+            (MediaController.prototype._containerWasClicked):
+
+2017-02-02  Matthew Hanson  &lt;matt_hanson@apple.com&gt;
+
</ins><span class="cx">         Merge r211438.
</span><span class="cx"> 
</span><span class="cx">     2017-01-31  Jessie Berlin  &lt;jberlin@webkit.org&gt;
</span></span></pre></div>
<a id="branchessafari60415branchSourceWebCoreModulesmodernmediacontrolsmediamediacontrollerjs"></a>
<div class="modfile"><h4>Modified: branches/safari-604.1.5-branch/Source/WebCore/Modules/modern-media-controls/media/media-controller.js (211575 => 211576)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-604.1.5-branch/Source/WebCore/Modules/modern-media-controls/media/media-controller.js        2017-02-02 19:20:06 UTC (rev 211575)
+++ branches/safari-604.1.5-branch/Source/WebCore/Modules/modern-media-controls/media/media-controller.js        2017-02-02 19:20:12 UTC (rev 211576)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> 
</span><span class="cx">         this.container = shadowRoot.appendChild(document.createElement(&quot;div&quot;));
</span><span class="cx">         this.container.className = &quot;media-controls-container&quot;;
</span><ins>+        this.container.addEventListener(&quot;click&quot;, this, true);
</ins><span class="cx"> 
</span><span class="cx">         if (host) {
</span><span class="cx">             host.controlsDependOnPageScaleFactor = this.layoutTraits &amp; LayoutTraits.iOS;
</span><span class="lines">@@ -78,6 +79,8 @@
</span><span class="cx">     {
</span><span class="cx">         if (event.type === &quot;resize&quot; &amp;&amp; event.currentTarget === this.shadowRoot)
</span><span class="cx">             this._updateControlsSize();
</span><ins>+        else if (event.type === &quot;click&quot; &amp;&amp; event.currentTarget === this.container)
+            this._containerWasClicked(event);
</ins><span class="cx">         else if (event.currentTarget === this.media) {
</span><span class="cx">             this._updateControlsIfNeeded();
</span><span class="cx">             if (event.type === &quot;webkitpresentationmodechanged&quot;)
</span><span class="lines">@@ -87,6 +90,13 @@
</span><span class="cx"> 
</span><span class="cx">     // Private
</span><span class="cx"> 
</span><ins>+    _containerWasClicked(event)
+    {
+        // We need to call preventDefault() here since, in the case of Media Documents,
+        // playback may be toggled when clicking on the video.
+        event.preventDefault();
+    }
+
</ins><span class="cx">     _updateControlsIfNeeded()
</span><span class="cx">     {
</span><span class="cx">         const previousControls = this.controls;
</span></span></pre>
</div>
</div>

</body>
</html>