<!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>[208271] 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/208271">208271</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-11-02 00:58:42 -0700 (Wed, 02 Nov 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Modern Media Controls] Media Controller: PiP support
https://bugs.webkit.org/show_bug.cgi?id=163730
&lt;rdar://problem/27989485&gt;

Patch by Antoine Quint &lt;graouts@apple.com&gt; on 2016-11-02
Reviewed by Dean Jackson.

Source/WebCore:

We introduce the PiPSupport class which brings support for entering picture-in-picture
by clicking on the PiP button in the media controls and enabling the button only when
picture-in-picture mode is available.

Tests: media/modern-media-controls/pip-support/pip-support-click.html
       media/modern-media-controls/pip-support/pip-support-enabled.html

* Modules/modern-media-controls/js-files:
* Modules/modern-media-controls/media/media-controller.js:
(MediaController):
* Modules/modern-media-controls/media/pip-support.js: Added.
(PiPSupport.prototype.get control):
(PiPSupport.prototype.get mediaEvents):
(PiPSupport.prototype.buttonWasClicked):
(PiPSupport.prototype.syncControl):
(PiPSupport):
* WebCore.xcodeproj/project.pbxproj:

LayoutTests:

Adding new picture-in-picture tests.

* media/modern-media-controls/pip-support/pip-support-click-expected.txt: Added.
* media/modern-media-controls/pip-support/pip-support-click.html: Added.
* media/modern-media-controls/pip-support/pip-support-enabled-expected.txt: Added.
* media/modern-media-controls/pip-support/pip-support-enabled.html: Added.
* platform/ios-simulator/TestExpectations:
* platform/mac/TestExpectations:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorTestExpectations">trunk/LayoutTests/platform/ios-simulator/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformmacTestExpectations">trunk/LayoutTests/platform/mac/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesmodernmediacontrolsjsfiles">trunk/Source/WebCore/Modules/modern-media-controls/js-files</a></li>
<li><a href="#trunkSourceWebCoreModulesmodernmediacontrolsmediamediacontrollerjs">trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/media/modern-media-controls/pip-support/</li>
<li><a href="#trunkLayoutTestsmediamodernmediacontrolspipsupportpipsupportclickexpectedtxt">trunk/LayoutTests/media/modern-media-controls/pip-support/pip-support-click-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediamodernmediacontrolspipsupportpipsupportclickhtml">trunk/LayoutTests/media/modern-media-controls/pip-support/pip-support-click.html</a></li>
<li><a href="#trunkLayoutTestsmediamodernmediacontrolspipsupportpipsupportenabledexpectedtxt">trunk/LayoutTests/media/modern-media-controls/pip-support/pip-support-enabled-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediamodernmediacontrolspipsupportpipsupportenabledhtml">trunk/LayoutTests/media/modern-media-controls/pip-support/pip-support-enabled.html</a></li>
<li><a href="#trunkSourceWebCoreModulesmodernmediacontrolsmediapipsupportjs">trunk/Source/WebCore/Modules/modern-media-controls/media/pip-support.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (208270 => 208271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-11-02 02:38:56 UTC (rev 208270)
+++ trunk/LayoutTests/ChangeLog        2016-11-02 07:58:42 UTC (rev 208271)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-11-02  Antoine Quint  &lt;graouts@apple.com&gt;
+
+        [Modern Media Controls] Media Controller: PiP support
+        https://bugs.webkit.org/show_bug.cgi?id=163730
+        &lt;rdar://problem/27989485&gt;
+
+        Reviewed by Dean Jackson.
+
+        Adding new picture-in-picture tests.
+
+        * media/modern-media-controls/pip-support/pip-support-click-expected.txt: Added.
+        * media/modern-media-controls/pip-support/pip-support-click.html: Added.
+        * media/modern-media-controls/pip-support/pip-support-enabled-expected.txt: Added.
+        * media/modern-media-controls/pip-support/pip-support-enabled.html: Added.
+        * platform/ios-simulator/TestExpectations:
+        * platform/mac/TestExpectations:
+
</ins><span class="cx"> 2016-11-01  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         IndexedDB 2.0: Support IDBIndex getAll/getAllKeys.
</span></span></pre></div>
<a id="trunkLayoutTestsmediamodernmediacontrolspipsupportpipsupportclickexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/modern-media-controls/pip-support/pip-support-click-expected.txt (0 => 208271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/modern-media-controls/pip-support/pip-support-click-expected.txt                                (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/pip-support/pip-support-click-expected.txt        2016-11-02 07:58:42 UTC (rev 208271)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Testing the PiPSupport behavior when clicking the PiP button.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS media.webkitPresentationMode is &quot;picture-in-picture&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsmediamodernmediacontrolspipsupportpipsupportclickhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/modern-media-controls/pip-support/pip-support-click.html (0 => 208271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/modern-media-controls/pip-support/pip-support-click.html                                (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/pip-support/pip-support-click.html        2016-11-02 07:58:42 UTC (rev 208271)
</span><span class="lines">@@ -0,0 +1,58 @@
</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;style type=&quot;text/css&quot; media=&quot;screen&quot;&gt;
+    
+    video, #host {
+        position: absolute;
+        top: 0;
+        left: 0;
+    }
+
+    video {
+        width: 800px;
+        height: 240px;
+    }
+    
+&lt;/style&gt;
+&lt;video src=&quot;../../content/test.mp4&quot; autoplay&gt;&lt;/video&gt;
+&lt;div id=&quot;host&quot;&gt;&lt;/div&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+
+window.jsTestIsAsync = true;
+
+description(&quot;Testing the &lt;code&gt;PiPSupport&lt;/code&gt; behavior when clicking the PiP button.&quot;);
+
+iconService.directoryPath = &quot;../../../../Source/WebCore/Modules/modern-media-controls/images&quot;;
+
+if (window.internals)
+    window.internals.settings.setAllowsPictureInPictureMediaPlayback(true);
+
+const container = document.querySelector(&quot;div#host&quot;);
+const media = document.querySelector(&quot;video&quot;);
+const mediaController = createControls(container, media, null);
+
+scheduler.frameDidFire = function() {
+    if (media.paused)
+        return;
+
+    const input = mediaController.controls.pipButton.element;
+    const bounds = input.getBoundingClientRect();
+    const centerX = bounds.left + bounds.width / 2;
+    const centerY = bounds.top + bounds.height / 2;
+
+    eventSender.mouseMoveTo(centerX, centerY);
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+};
+
+media.addEventListener(&quot;webkitpresentationmodechanged&quot;, () =&gt; {
+    shouldBeEqualToString(&quot;media.webkitPresentationMode&quot;, &quot;picture-in-picture&quot;);
+    container.remove();
+    media.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="trunkLayoutTestsmediamodernmediacontrolspipsupportpipsupportenabledexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/modern-media-controls/pip-support/pip-support-enabled-expected.txt (0 => 208271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/modern-media-controls/pip-support/pip-support-enabled-expected.txt                                (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/pip-support/pip-support-enabled-expected.txt        2016-11-02 07:58:42 UTC (rev 208271)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+Testing the PipSupport behavior.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS mediaController.controls.pipButton.enabled is true
+PASS mediaController.controls.pipButton.enabled is false
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsmediamodernmediacontrolspipsupportpipsupportenabledhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/modern-media-controls/pip-support/pip-support-enabled.html (0 => 208271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/modern-media-controls/pip-support/pip-support-enabled.html                                (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/pip-support/pip-support-enabled.html        2016-11-02 07:58:42 UTC (rev 208271)
</span><span class="lines">@@ -0,0 +1,50 @@
</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;style type=&quot;text/css&quot; media=&quot;screen&quot;&gt;
+    
+    video, #host {
+        position: absolute;
+        top: 0;
+        left: 0;
+    }
+
+    video {
+        width: 800px;
+        height: 240px;
+    }
+    
+&lt;/style&gt;
+&lt;video src=&quot;../../content/test.mp4&quot;&gt;&lt;/video&gt;
+&lt;div id=&quot;host&quot;&gt;&lt;/div&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+
+window.jsTestIsAsync = true;
+
+description(&quot;Testing the &lt;code&gt;PipSupport&lt;/code&gt; behavior.&quot;);
+
+iconService.directoryPath = &quot;../../../../Source/WebCore/Modules/modern-media-controls/images&quot;;
+
+if (window.internals)
+    window.internals.settings.setAllowsPictureInPictureMediaPlayback(true);
+
+const container = document.querySelector(&quot;div#host&quot;);
+const media = document.querySelector(&quot;video&quot;);
+const mediaController = createControls(container, media, null);
+
+media.addEventListener(&quot;loadedmetadata&quot;, () =&gt; {
+    shouldBeTrue(&quot;mediaController.controls.pipButton.enabled&quot;);
+    media.src = &quot;&quot;;
+});
+
+media.addEventListener(&quot;error&quot;, () =&gt; {
+    shouldBeFalse(&quot;mediaController.controls.pipButton.enabled&quot;);
+    debug(&quot;&quot;);
+    container.remove();
+    media.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="trunkLayoutTestsplatformiossimulatorTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (208270 => 208271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/TestExpectations        2016-11-02 02:38:56 UTC (rev 208270)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations        2016-11-02 07:58:42 UTC (rev 208271)
</span><span class="lines">@@ -2743,5 +2743,6 @@
</span><span class="cx"> fast/layers/prevent-hit-test-during-layout.html [ Skip ]
</span><span class="cx"> 
</span><span class="cx"> # Internal APIs to test PiP and AirPlay are not available on iOS.
</span><ins>+media/modern-media-controls/airplay-support/airplay-support.html [ Skip ]
+media/modern-media-controls/pip-support [ Skip ]
</ins><span class="cx"> media/modern-media-controls/placard-support [ Skip ]
</span><del>-media/modern-media-controls/airplay-support/airplay-support.html [ Skip ]
</del></span></pre></div>
<a id="trunkLayoutTestsplatformmacTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/TestExpectations (208270 => 208271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/TestExpectations        2016-11-02 02:38:56 UTC (rev 208270)
+++ trunk/LayoutTests/platform/mac/TestExpectations        2016-11-02 07:58:42 UTC (rev 208271)
</span><span class="lines">@@ -1452,7 +1452,8 @@
</span><span class="cx"> webkit.org/b/164088 [ Yosemite ] media/modern-media-controls/scrubber-support/scrubber-support-drag.html [ Skip ]
</span><span class="cx"> 
</span><span class="cx"> # Internal APIs to test PiP and AirPlay are not available on Yosemite.
</span><ins>+[ Yosemite ] media/modern-media-controls/airplay-support/airplay-support.html [ Skip ]
+[ Yosemite ] media/modern-media-controls/pip-support [ Skip ]
</ins><span class="cx"> [ Yosemite ] media/modern-media-controls/placard-support [ Skip ]
</span><del>-[ Yosemite ] media/modern-media-controls/airplay-support/airplay-support.html [ Skip ]
</del><span class="cx"> 
</span><span class="cx"> webkit.org/b/164277 fast/preloader/image-srcset.html [ Pass Failure ]
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (208270 => 208271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-11-02 02:38:56 UTC (rev 208270)
+++ trunk/Source/WebCore/ChangeLog        2016-11-02 07:58:42 UTC (rev 208271)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2016-11-02  Antoine Quint  &lt;graouts@apple.com&gt;
+
+        [Modern Media Controls] Media Controller: PiP support
+        https://bugs.webkit.org/show_bug.cgi?id=163730
+        &lt;rdar://problem/27989485&gt;
+
+        Reviewed by Dean Jackson.
+
+        We introduce the PiPSupport class which brings support for entering picture-in-picture
+        by clicking on the PiP button in the media controls and enabling the button only when
+        picture-in-picture mode is available.
+
+        Tests: media/modern-media-controls/pip-support/pip-support-click.html
+               media/modern-media-controls/pip-support/pip-support-enabled.html
+
+        * Modules/modern-media-controls/js-files:
+        * Modules/modern-media-controls/media/media-controller.js:
+        (MediaController):
+        * Modules/modern-media-controls/media/pip-support.js: Added.
+        (PiPSupport.prototype.get control):
+        (PiPSupport.prototype.get mediaEvents):
+        (PiPSupport.prototype.buttonWasClicked):
+        (PiPSupport.prototype.syncControl):
+        (PiPSupport):
+        * WebCore.xcodeproj/project.pbxproj:
+
</ins><span class="cx"> 2016-11-01  Dave Hyatt  &lt;hyatt@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [CSS Parser] Support the shadow DOM
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmodernmediacontrolsjsfiles"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/modern-media-controls/js-files (208270 => 208271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/modern-media-controls/js-files        2016-11-02 02:38:56 UTC (rev 208270)
+++ trunk/Source/WebCore/Modules/modern-media-controls/js-files        2016-11-02 07:58:42 UTC (rev 208271)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> media/airplay-support.js
</span><span class="cx"> media/elapsed-time-support.js
</span><span class="cx"> media/mute-support.js
</span><ins>+media/pip-support.js
</ins><span class="cx"> media/placard-support.js
</span><span class="cx"> media/playback-support.js
</span><span class="cx"> media/remaining-time-support.js
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmodernmediacontrolsmediamediacontrollerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js (208270 => 208271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js        2016-11-02 02:38:56 UTC (rev 208270)
+++ trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js        2016-11-02 07:58:42 UTC (rev 208271)
</span><span class="lines">@@ -41,6 +41,7 @@
</span><span class="cx">         new AirplaySupport(this);
</span><span class="cx">         new ElapsedTimeSupport(this);
</span><span class="cx">         new MuteSupport(this);
</span><ins>+        new PiPSupport(this);
</ins><span class="cx">         new PlacardSupport(this);
</span><span class="cx">         new PlaybackSupport(this);
</span><span class="cx">         new RemainingTimeSupport(this);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmodernmediacontrolsmediapipsupportjsfromrev208270trunkSourceWebCoreModulesmodernmediacontrolsmediamediacontrollerjs"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/Modules/modern-media-controls/media/pip-support.js (from rev 208270, trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js) (0 => 208271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/modern-media-controls/media/pip-support.js                                (rev 0)
+++ trunk/Source/WebCore/Modules/modern-media-controls/media/pip-support.js        2016-11-02 07:58:42 UTC (rev 208271)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+const PiPMode = &quot;picture-in-picture&quot;;
+const InlineMode = &quot;inline&quot;;
+
+class PiPSupport extends MediaControllerSupport
+{
+
+    // Protected
+
+    get control()
+    {
+        return this.mediaController.controls.pipButton;
+    }
+
+    get mediaEvents()
+    {
+        return [&quot;loadedmetadata&quot;, &quot;error&quot;, &quot;webkitpresentationmodechanged&quot;, &quot;webkitcurrentplaybacktargetiswirelesschanged&quot;];
+    }
+
+    buttonWasClicked(control)
+    {
+        const media = this.mediaController.media;
+        media.webkitSetPresentationMode(media.webkitPresentationMode === PiPMode ? InlineMode : PiPMode);
+    }
+
+    syncControl()
+    {
+        const media = this.mediaController.media;
+        this.control.enabled = media instanceof HTMLVideoElement &amp;&amp; media.webkitSupportsPresentationMode &amp;&amp; media.webkitSupportsPresentationMode(PiPMode) &amp;&amp; !media.webkitCurrentPlaybackTargetIsWireless;
+    }
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (208270 => 208271)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-11-02 02:38:56 UTC (rev 208270)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-11-02 07:58:42 UTC (rev 208271)
</span><span class="lines">@@ -7446,8 +7446,8 @@
</span><span class="cx">                 0F87166E1C869D83004FF0DE /* LengthPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LengthPoint.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0F8B456F1DC3FB1000443C3F /* IntersectionObserverCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IntersectionObserverCallback.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0F8B45711DC3FBA300443C3F /* IntersectionObserverCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntersectionObserverCallback.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                0F8B45731DC41DBA00443C3F /* JSIntersectionObserverCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSIntersectionObserverCallback.cpp; path = JSIntersectionObserverCallback.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                0F8B45741DC41DBA00443C3F /* JSIntersectionObserverCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSIntersectionObserverCallback.h; path = JSIntersectionObserverCallback.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                0F8B45731DC41DBA00443C3F /* JSIntersectionObserverCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIntersectionObserverCallback.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                0F8B45741DC41DBA00443C3F /* JSIntersectionObserverCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIntersectionObserverCallback.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 0F97A657155DA81E00FADD4C /* DisplayRefreshMonitorIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DisplayRefreshMonitorIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0FA24D77162DF91900A3F4C0 /* GraphicsLayerUpdater.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsLayerUpdater.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0FA24D78162DF91900A3F4C0 /* GraphicsLayerUpdater.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsLayerUpdater.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -9863,6 +9863,7 @@
</span><span class="cx">                 7118FED215685CC60030B79A /* JSSVGViewSpec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGViewSpec.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7118FED315685CC60030B79A /* JSSVGViewSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSVGViewSpec.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 711FB0751DC7688F00C4C708 /* placard-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = &quot;placard-support.js&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                7130141D1DC9C08600CA3A88 /* pip-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = &quot;pip-support.js&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 7134496B146941B300720312 /* SVGLengthContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGLengthContext.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7134496C146941B300720312 /* SVGLengthContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGLengthContext.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 713E70AF1733E8B300A22D00 /* plugIns.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = plugIns.js; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -17875,6 +17876,7 @@
</span><span class="cx">                                 7177E2461DB80D2F00919A0B /* media-controller-support.js */,
</span><span class="cx">                                 71D02D921DB55C4E00DD5CF5 /* media-controller.js */,
</span><span class="cx">                                 7177E2471DB80D2F00919A0B /* mute-support.js */,
</span><ins>+                                7130141D1DC9C08600CA3A88 /* pip-support.js */,
</ins><span class="cx">                                 711FB0751DC7688F00C4C708 /* placard-support.js */,
</span><span class="cx">                                 71004B9D1DC1398800A52A38 /* playback-support.js */,
</span><span class="cx">                                 71004B9B1DC1109300A52A38 /* remaining-time-support.js */,
</span></span></pre>
</div>
</div>

</body>
</html>