<!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>[201963] trunk/Source</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/201963">201963</a></dd>
<dt>Author</dt> <dd>adachan@apple.com</dd>
<dt>Date</dt> <dd>2016-06-10 21:37:06 -0700 (Fri, 10 Jun 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Use the video element's video box when getting the inline video rect in WebVideoFullscreenManager
https://bugs.webkit.org/show_bug.cgi?id=158351
&lt;rdar://problem/26567938&gt;

Reviewed by Darin Adler.

Source/WebCore:

* WebCore.xcodeproj/project.pbxproj:
Change the visibility of RenderVideo.h and RenderMedia.h since we'll be importing RenderVideo.h from WebKit2.
* rendering/RenderVideo.h:

Source/WebKit2:

* WebProcess/cocoa/WebVideoFullscreenManager.mm:
(WebKit::inlineVideoFrame):
(WebKit::WebVideoFullscreenManager::enterVideoFullscreenForVideoElement):
(WebKit::WebVideoFullscreenManager::exitVideoFullscreenForVideoElement):
(WebKit::WebVideoFullscreenManager::fullscreenMayReturnToInline):
(WebKit::WebVideoFullscreenManager::setVideoLayerFrameFenced):
(WebKit::clientRectForElement): Deleted.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderVideoh">trunk/Source/WebCore/rendering/RenderVideo.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcesscocoaWebVideoFullscreenManagermm">trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (201962 => 201963)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-06-11 04:24:27 UTC (rev 201962)
+++ trunk/Source/WebCore/ChangeLog        2016-06-11 04:37:06 UTC (rev 201963)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2016-06-10  Ada Chan  &lt;adachan@apple.com&gt;
+
+        Use the video element's video box when getting the inline video rect in WebVideoFullscreenManager
+        https://bugs.webkit.org/show_bug.cgi?id=158351
+        &lt;rdar://problem/26567938&gt;
+
+        Reviewed by Darin Adler.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        Change the visibility of RenderVideo.h and RenderMedia.h since we'll be importing RenderVideo.h from WebKit2.
+        * rendering/RenderVideo.h:
+
</ins><span class="cx"> 2016-06-10  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add support for passive event listeners on touch events
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (201962 => 201963)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-06-11 04:24:27 UTC (rev 201962)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-06-11 04:37:06 UTC (rev 201963)
</span><span class="lines">@@ -6639,7 +6639,7 @@
</span><span class="cx">                 E446143B0CD689CC00FADA75 /* JSHTMLSourceElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4B423710CBFB6E000AF2ECE /* JSHTMLSourceElement.cpp */; };
</span><span class="cx">                 E446143C0CD689CC00FADA75 /* JSHTMLSourceElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E4B423720CBFB6E000AF2ECE /* JSHTMLSourceElement.h */; };
</span><span class="cx">                 E44614510CD68A3500FADA75 /* RenderVideo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4B41E330CBFB60900AF2ECE /* RenderVideo.cpp */; };
</span><del>-                E44614520CD68A3500FADA75 /* RenderVideo.h in Headers */ = {isa = PBXBuildFile; fileRef = E4B41E340CBFB60900AF2ECE /* RenderVideo.h */; };
</del><ins>+                E44614520CD68A3500FADA75 /* RenderVideo.h in Headers */ = {isa = PBXBuildFile; fileRef = E4B41E340CBFB60900AF2ECE /* RenderVideo.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 E44B4BB3141650D7002B1D8B /* SelectorChecker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E44B4BB1141650D7002B1D8B /* SelectorChecker.cpp */; };
</span><span class="cx">                 E44B4BB4141650D7002B1D8B /* SelectorChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = E44B4BB2141650D7002B1D8B /* SelectorChecker.h */; };
</span><span class="cx">                 E44EE3A817577EBD00EEE8CF /* FontGenericFamilies.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E44EE3A617576E5500EEE8CF /* FontGenericFamilies.cpp */; };
</span><span class="lines">@@ -6710,7 +6710,7 @@
</span><span class="cx">                 E4C1789A0EE6903800824D69 /* CSSSelectorList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4C178950EE6903800824D69 /* CSSSelectorList.cpp */; };
</span><span class="cx">                 E4C1789B0EE6903800824D69 /* CSSSelectorList.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C178960EE6903800824D69 /* CSSSelectorList.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 E4C279580CF9741900E97B98 /* RenderMedia.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4C279560CF9741900E97B98 /* RenderMedia.cpp */; };
</span><del>-                E4C279590CF9741900E97B98 /* RenderMedia.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C279570CF9741900E97B98 /* RenderMedia.h */; };
</del><ins>+                E4C279590CF9741900E97B98 /* RenderMedia.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C279570CF9741900E97B98 /* RenderMedia.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 E4C3B1FA0F0E4161009693F6 /* LegacyTileCache.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C3B1F90F0E4161009693F6 /* LegacyTileCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 E4C3B1FC0F0E4170009693F6 /* LegacyTileCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4C3B1FB0F0E4170009693F6 /* LegacyTileCache.mm */; };
</span><span class="cx">                 E4C91A0E1802343100A17F6D /* TextPaintStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C91A0D1802343100A17F6D /* TextPaintStyle.h */; };
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderVideoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderVideo.h (201962 => 201963)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderVideo.h        2016-06-11 04:24:27 UTC (rev 201962)
+++ trunk/Source/WebCore/rendering/RenderVideo.h        2016-06-11 04:37:06 UTC (rev 201963)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx"> 
</span><span class="cx">     HTMLVideoElement&amp; videoElement() const;
</span><span class="cx"> 
</span><del>-    IntRect videoBox() const;
</del><ins>+    WEBCORE_EXPORT IntRect videoBox() const;
</ins><span class="cx"> 
</span><span class="cx">     static IntSize defaultSize();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (201962 => 201963)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-06-11 04:24:27 UTC (rev 201962)
+++ trunk/Source/WebKit2/ChangeLog        2016-06-11 04:37:06 UTC (rev 201963)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2016-06-10  Ada Chan  &lt;adachan@apple.com&gt;
+
+        Use the video element's video box when getting the inline video rect in WebVideoFullscreenManager
+        https://bugs.webkit.org/show_bug.cgi?id=158351
+        &lt;rdar://problem/26567938&gt;
+
+        Reviewed by Darin Adler.
+
+        * WebProcess/cocoa/WebVideoFullscreenManager.mm:
+        (WebKit::inlineVideoFrame):
+        (WebKit::WebVideoFullscreenManager::enterVideoFullscreenForVideoElement):
+        (WebKit::WebVideoFullscreenManager::exitVideoFullscreenForVideoElement):
+        (WebKit::WebVideoFullscreenManager::fullscreenMayReturnToInline):
+        (WebKit::WebVideoFullscreenManager::setVideoLayerFrameFenced):
+        (WebKit::clientRectForElement): Deleted.
+
</ins><span class="cx"> 2016-06-10  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add support for passive event listeners on touch events
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcesscocoaWebVideoFullscreenManagermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm (201962 => 201963)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm        2016-06-11 04:24:27 UTC (rev 201962)
+++ trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm        2016-06-11 04:37:06 UTC (rev 201963)
</span><span class="lines">@@ -43,6 +43,7 @@
</span><span class="cx"> #import &lt;WebCore/PlatformCALayer.h&gt;
</span><span class="cx"> #import &lt;WebCore/RenderLayer.h&gt;
</span><span class="cx"> #import &lt;WebCore/RenderLayerBacking.h&gt;
</span><ins>+#import &lt;WebCore/RenderVideo.h&gt;
</ins><span class="cx"> #import &lt;WebCore/RenderView.h&gt;
</span><span class="cx"> #import &lt;WebCore/Settings.h&gt;
</span><span class="cx"> #import &lt;WebCore/TimeRanges.h&gt;
</span><span class="lines">@@ -52,12 +53,15 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-static IntRect clientRectForElement(HTMLElement* element)
</del><ins>+static IntRect inlineVideoFrame(HTMLVideoElement&amp; element)
</ins><span class="cx"> {
</span><del>-    if (!element)
-        return IntRect();
-
-    return element-&gt;clientRect();
</del><ins>+    element.document().updateLayoutIgnorePendingStylesheets();
+    auto* renderer = element.renderer();
+    if (!renderer)
+        return { };
+    auto rect = renderer-&gt;videoBox();
+    rect.moveBy(renderer-&gt;absoluteBoundingBoxRect().location());
+    return element.document().view()-&gt;contentsToRootView(rect);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #pragma mark - WebVideoFullscreenInterfaceContext
</span><span class="lines">@@ -275,8 +279,8 @@
</span><span class="cx">     if (!interface-&gt;layerHostingContext())
</span><span class="cx">         interface-&gt;setLayerHostingContext(LayerHostingContext::createForExternalHostingProcess());
</span><span class="cx"> 
</span><del>-    FloatRect clientRect = clientRectForElement(&amp;videoElement);
-    FloatRect videoLayerFrame = FloatRect(0, 0, clientRect.width(), clientRect.height());
</del><ins>+    auto videoRect = inlineVideoFrame(videoElement);
+    FloatRect videoLayerFrame = FloatRect(0, 0, videoRect.width(), videoRect.height());
</ins><span class="cx"> 
</span><span class="cx">     HTMLMediaElementEnums::VideoFullscreenMode oldMode = interface-&gt;fullscreenMode();
</span><span class="cx">     interface-&gt;setTargetIsFullscreen(true);
</span><span class="lines">@@ -291,7 +295,7 @@
</span><span class="cx"> 
</span><span class="cx">     bool allowsPictureInPicture = videoElement.mediaSession().allowsPictureInPicture(videoElement);
</span><span class="cx">     
</span><del>-    m_page-&gt;send(Messages::WebVideoFullscreenManagerProxy::SetupFullscreenWithID(contextId, interface-&gt;layerHostingContext()-&gt;contextID(), clientRectForElement(&amp;videoElement), m_page-&gt;deviceScaleFactor(), interface-&gt;fullscreenMode(), allowsPictureInPicture), m_page-&gt;pageID());
</del><ins>+    m_page-&gt;send(Messages::WebVideoFullscreenManagerProxy::SetupFullscreenWithID(contextId, interface-&gt;layerHostingContext()-&gt;contextID(), videoRect, m_page-&gt;deviceScaleFactor(), interface-&gt;fullscreenMode(), allowsPictureInPicture), m_page-&gt;pageID());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebVideoFullscreenManager::exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&amp; videoElement)
</span><span class="lines">@@ -307,7 +311,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     interface.setIsAnimating(true);
</span><del>-    m_page-&gt;send(Messages::WebVideoFullscreenManagerProxy::ExitFullscreen(contextId, clientRectForElement(&amp;videoElement)), m_page-&gt;pageID());
</del><ins>+    m_page-&gt;send(Messages::WebVideoFullscreenManagerProxy::ExitFullscreen(contextId, inlineVideoFrame(videoElement)), m_page-&gt;pageID());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebVideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation(WebCore::HTMLVideoElement&amp; videoElement, WebCore::HTMLMediaElementEnums::VideoFullscreenMode targetMode)
</span><span class="lines">@@ -464,7 +468,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (!isPageVisible)
</span><span class="cx">         model.videoElement()-&gt;scrollIntoViewIfNotVisible(false);
</span><del>-    m_page-&gt;send(Messages::WebVideoFullscreenManagerProxy::PreparedToReturnToInline(contextId, true, clientRectForElement(model.videoElement())), m_page-&gt;pageID());
</del><ins>+    m_page-&gt;send(Messages::WebVideoFullscreenManagerProxy::PreparedToReturnToInline(contextId, true, inlineVideoFrame(*model.videoElement())), m_page-&gt;pageID());
</ins><span class="cx"> }
</span><span class="cx">     
</span><span class="cx"> void WebVideoFullscreenManager::setVideoLayerFrameFenced(uint64_t contextId, WebCore::FloatRect bounds, IPC::Attachment fencePort)
</span><span class="lines">@@ -474,8 +478,8 @@
</span><span class="cx">     std::tie(model, interface) = ensureModelAndInterface(contextId);
</span><span class="cx"> 
</span><span class="cx">     if (std::isnan(bounds.x()) || std::isnan(bounds.y()) || std::isnan(bounds.width()) || std::isnan(bounds.height())) {
</span><del>-        FloatRect clientRect = clientRectForElement(model-&gt;videoElement());
-        bounds = FloatRect(0, 0, clientRect.width(), clientRect.height());
</del><ins>+        auto videoRect = inlineVideoFrame(*model-&gt;videoElement());
+        bounds = FloatRect(0, 0, videoRect.width(), videoRect.height());
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     [CATransaction begin];
</span></span></pre>
</div>
</div>

</body>
</html>