<!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>[173702] trunk/Source/WebKit2</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/173702">173702</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2014-09-17 14:18:04 -0700 (Wed, 17 Sep 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fix an issue that caused video playback to not always use high resolution streams
https://bugs.webkit.org/show_bug.cgi?id=136879
rdar://problem/18316542

Reviewed by Eric Carlson.

The underlying video framework expects to be able to use -[CALayer convertRect:toLayer:nil] on
the video layer to obtain information about the display resolution of the video,
including the device scale factor. This doesn't work for layers in the web process,
which are remotely hosted into the UI process.

For now, use a workaround which involves putting a scale transform equivalent to
the device scale factor on the web process layer, and the inverse scale on the
hosting layer in the UI process.

We have to do this in two places, for in-page video, and for fullscreen video.

* Shared/mac/RemoteLayerTreeTransaction.h: Add hostingDeviceScaleFactor to the LayerCreation
properties.
* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::LayerCreationProperties):
(WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::encode):
(WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::decode):
* UIProcess/ios/RemoteLayerTreeHostIOS.mm:
(-[WKRemoteView initWithFrame:contextID:hostingDeviceScaleFactor:]): Set the inverse scale
transform on the layer.
(WebKit::RemoteLayerTreeHost::createLayer):
(-[WKRemoteView initWithFrame:contextID:]): Deleted.
* UIProcess/ios/WebVideoFullscreenManagerProxy.h:
* UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in:
* UIProcess/ios/WebVideoFullscreenManagerProxy.mm:
(WebKit::WebVideoFullscreenManagerProxy::setupFullscreenWithID):
* WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm:
(WebKit::PlatformCALayerRemoteCustom::PlatformCALayerRemoteCustom):
* WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
(WebKit::RemoteLayerTreeContext::deviceScaleFactor):
* WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
(WebKit::RemoteLayerTreeContext::layerWasCreated):
* WebProcess/ios/WebVideoFullscreenManager.mm:
(WebKit::WebVideoFullscreenManager::enterFullscreenForNode):
(WebKit::WebVideoFullscreenManager::didSetupFullscreen):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedmacRemoteLayerTreeTransactionh">trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h</a></li>
<li><a href="#trunkSourceWebKit2SharedmacRemoteLayerTreeTransactionmm">trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosRemoteLayerTreeHostIOSmm">trunk/Source/WebKit2/UIProcess/ios/RemoteLayerTreeHostIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWebVideoFullscreenManagerProxyh">trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWebVideoFullscreenManagerProxymessagesin">trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWebVideoFullscreenManagerProxymm">trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacPlatformCALayerRemoteCustommm">trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeContexth">trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeContextmm">trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessiosWebVideoFullscreenManagermm">trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (173701 => 173702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-09-17 20:45:53 UTC (rev 173701)
+++ trunk/Source/WebKit2/ChangeLog        2014-09-17 21:18:04 UTC (rev 173702)
</span><span class="lines">@@ -1,3 +1,47 @@
</span><ins>+2014-09-17  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Fix an issue that caused video playback to not always use high resolution streams
+        https://bugs.webkit.org/show_bug.cgi?id=136879
+        rdar://problem/18316542
+
+        Reviewed by Eric Carlson.
+        
+        The underlying video framework expects to be able to use -[CALayer convertRect:toLayer:nil] on
+        the video layer to obtain information about the display resolution of the video,
+        including the device scale factor. This doesn't work for layers in the web process,
+        which are remotely hosted into the UI process.
+        
+        For now, use a workaround which involves putting a scale transform equivalent to
+        the device scale factor on the web process layer, and the inverse scale on the 
+        hosting layer in the UI process.
+        
+        We have to do this in two places, for in-page video, and for fullscreen video.
+
+        * Shared/mac/RemoteLayerTreeTransaction.h: Add hostingDeviceScaleFactor to the LayerCreation
+        properties.
+        * Shared/mac/RemoteLayerTreeTransaction.mm:
+        (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::LayerCreationProperties):
+        (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::encode):
+        (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::decode):
+        * UIProcess/ios/RemoteLayerTreeHostIOS.mm:
+        (-[WKRemoteView initWithFrame:contextID:hostingDeviceScaleFactor:]): Set the inverse scale
+        transform on the layer.
+        (WebKit::RemoteLayerTreeHost::createLayer):
+        (-[WKRemoteView initWithFrame:contextID:]): Deleted.
+        * UIProcess/ios/WebVideoFullscreenManagerProxy.h:
+        * UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in:
+        * UIProcess/ios/WebVideoFullscreenManagerProxy.mm:
+        (WebKit::WebVideoFullscreenManagerProxy::setupFullscreenWithID):
+        * WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm:
+        (WebKit::PlatformCALayerRemoteCustom::PlatformCALayerRemoteCustom):
+        * WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
+        (WebKit::RemoteLayerTreeContext::deviceScaleFactor):
+        * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
+        (WebKit::RemoteLayerTreeContext::layerWasCreated):
+        * WebProcess/ios/WebVideoFullscreenManager.mm:
+        (WebKit::WebVideoFullscreenManager::enterFullscreenForNode):
+        (WebKit::WebVideoFullscreenManager::didSetupFullscreen):
+
</ins><span class="cx"> 2014-09-17  Gavin Barraclough  &lt;baraclough@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Aways have a PageThrottler (sometimes have a UserActivity::Impl)
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacRemoteLayerTreeTransactionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h (173701 => 173702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h        2014-09-17 20:45:53 UTC (rev 173701)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h        2014-09-17 21:18:04 UTC (rev 173702)
</span><span class="lines">@@ -95,6 +95,7 @@
</span><span class="cx">         WebCore::PlatformCALayer::LayerType type;
</span><span class="cx"> 
</span><span class="cx">         uint32_t hostingContextID;
</span><ins>+        float hostingDeviceScaleFactor;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     struct LayerProperties {
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacRemoteLayerTreeTransactionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm (173701 => 173702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm        2014-09-17 20:45:53 UTC (rev 173701)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm        2014-09-17 21:18:04 UTC (rev 173702)
</span><span class="lines">@@ -47,6 +47,7 @@
</span><span class="cx">     : layerID(0)
</span><span class="cx">     , type(PlatformCALayer::LayerTypeLayer)
</span><span class="cx">     , hostingContextID(0)
</span><ins>+    , hostingDeviceScaleFactor(1)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -55,6 +56,7 @@
</span><span class="cx">     encoder &lt;&lt; layerID;
</span><span class="cx">     encoder.encodeEnum(type);
</span><span class="cx">     encoder &lt;&lt; hostingContextID;
</span><ins>+    encoder &lt;&lt; hostingDeviceScaleFactor;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool RemoteLayerTreeTransaction::LayerCreationProperties::decode(IPC::ArgumentDecoder&amp; decoder, LayerCreationProperties&amp; result)
</span><span class="lines">@@ -68,6 +70,9 @@
</span><span class="cx">     if (!decoder.decode(result.hostingContextID))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><ins>+    if (!decoder.decode(result.hostingDeviceScaleFactor))
+        return false;
+
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosRemoteLayerTreeHostIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/RemoteLayerTreeHostIOS.mm (173701 => 173702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/RemoteLayerTreeHostIOS.mm        2014-09-17 20:45:53 UTC (rev 173701)
+++ trunk/Source/WebKit2/UIProcess/ios/RemoteLayerTreeHostIOS.mm        2014-09-17 21:18:04 UTC (rev 173702)
</span><span class="lines">@@ -108,10 +108,13 @@
</span><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> @implementation WKRemoteView
</span><del>-- (instancetype)initWithFrame:(CGRect)frame contextID:(uint32_t)contextID
</del><ins>+- (instancetype)initWithFrame:(CGRect)frame contextID:(uint32_t)contextID hostingDeviceScaleFactor:(float)scaleFactor
</ins><span class="cx"> {
</span><span class="cx">     if ((self = [super initWithFrame:frame])) {
</span><span class="cx">         [[self layer] setContextId:contextID];
</span><ins>+        // Invert the scale transform added in the WebProcess to fix &lt;rdar://problem/18316542&gt;.
+        float inverseScale = 1 / scaleFactor;
+        [[self layer] setTransform:CATransform3DMakeScale(inverseScale, inverseScale, 1)];
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     return self;
</span><span class="lines">@@ -155,7 +158,7 @@
</span><span class="cx">     case PlatformCALayer::LayerTypeAVPlayerLayer:
</span><span class="cx">     case PlatformCALayer::LayerTypeWebGLLayer:
</span><span class="cx">         if (!m_isDebugLayerTreeHost)
</span><del>-            view = adoptNS([[WKRemoteView alloc] initWithFrame:CGRectZero contextID:properties.hostingContextID]);
</del><ins>+            view = adoptNS([[WKRemoteView alloc] initWithFrame:CGRectZero contextID:properties.hostingContextID hostingDeviceScaleFactor:properties.hostingDeviceScaleFactor]);
</ins><span class="cx">         else
</span><span class="cx">             view = adoptNS([[WKCompositingView alloc] init]);
</span><span class="cx">         break;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebVideoFullscreenManagerProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h (173701 => 173702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h        2014-09-17 20:45:53 UTC (rev 173701)
+++ trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h        2014-09-17 21:18:04 UTC (rev 173702)
</span><span class="lines">@@ -55,7 +55,7 @@
</span><span class="cx">     virtual void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&amp;) override;
</span><span class="cx"> 
</span><span class="cx">     // Translate to FullscreenInterface
</span><del>-    void setupFullscreenWithID(uint32_t, WebCore::IntRect initialRect);
</del><ins>+    void setupFullscreenWithID(uint32_t, WebCore::IntRect initialRect, float hostingDeviceScaleFactor);
</ins><span class="cx">     void setSeekableRangesVector(Vector&lt;std::pair&lt;double, double&gt;&gt;&amp;);
</span><span class="cx">     void setExternalPlaybackProperties(bool enabled, uint32_t targetType, String localizedDeviceName);
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebVideoFullscreenManagerProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in (173701 => 173702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in        2014-09-17 20:45:53 UTC (rev 173701)
+++ trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in        2014-09-17 21:18:04 UTC (rev 173702)
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx">     SetExternalPlaybackProperties(bool enabled, uint32_t targetType, String localizedDeviceName);
</span><span class="cx">     SetDuration(double duration)
</span><span class="cx">     SetRate(bool isPlaying, double rate)
</span><del>-    SetupFullscreenWithID(uint32_t videoLayerID, WebCore::IntRect initialRect)
</del><ins>+    SetupFullscreenWithID(uint32_t videoLayerID, WebCore::IntRect initialRect, float hostingScaleFactor)
</ins><span class="cx">     EnterFullscreen()
</span><span class="cx">     ExitFullscreen(WebCore::IntRect finalRect)
</span><span class="cx">     CleanupFullscreen()
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebVideoFullscreenManagerProxymm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm (173701 => 173702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm        2014-09-17 20:45:53 UTC (rev 173701)
+++ trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm        2014-09-17 21:18:04 UTC (rev 173702)
</span><span class="lines">@@ -72,10 +72,16 @@
</span><span class="cx">     m_layerHost.clear();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebVideoFullscreenManagerProxy::setupFullscreenWithID(uint32_t videoLayerID, WebCore::IntRect initialRect)
</del><ins>+void WebVideoFullscreenManagerProxy::setupFullscreenWithID(uint32_t videoLayerID, WebCore::IntRect initialRect, float hostingDeviceScaleFactor)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(videoLayerID);
</span><span class="cx">     m_layerHost = WKMakeRenderLayer(videoLayerID);
</span><ins>+    if (hostingDeviceScaleFactor != 1) {
+        // Invert the scale transform added in the WebProcess to fix &lt;rdar://problem/18316542&gt;.
+        float inverseScale = 1 / hostingDeviceScaleFactor;
+        [m_layerHost setTransform:CATransform3DMakeScale(inverseScale, inverseScale, 1)];
+    }
+
</ins><span class="cx">     UIView *parentView = toRemoteLayerTreeDrawingAreaProxy(m_page-&gt;drawingArea())-&gt;remoteLayerTreeHost().rootLayer();
</span><span class="cx">     setupFullscreen(*m_layerHost.get(), initialRect, parentView);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacPlatformCALayerRemoteCustommm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm (173701 => 173702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm        2014-09-17 20:45:53 UTC (rev 173701)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm        2014-09-17 21:18:04 UTC (rev 173702)
</span><span class="lines">@@ -64,6 +64,12 @@
</span><span class="cx"> #if HAVE(OUT_OF_PROCESS_LAYER_HOSTING)
</span><span class="cx">     case LayerHostingMode::OutOfProcess:
</span><span class="cx">         m_layerHostingContext = LayerHostingContext::createForExternalHostingProcess();
</span><ins>+#if PLATFORM(IOS)
+        float scaleFactor = context.deviceScaleFactor();
+        // Set a scale factor here to make convertRect:toLayer:nil take scale factor into account. &lt;rdar://problem/18316542&gt;.
+        // This scale factor is inverted in the hosting process.
+        [customLayer setTransform:CATransform3DMakeScale(scaleFactor, scaleFactor, 1)];
+#endif
</ins><span class="cx">         break;
</span><span class="cx"> #endif
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h (173701 => 173702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h        2014-09-17 20:45:53 UTC (rev 173701)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h        2014-09-17 21:18:04 UTC (rev 173702)
</span><span class="lines">@@ -55,6 +55,8 @@
</span><span class="cx"> 
</span><span class="cx">     WebCore::LayerPool&amp; layerPool() { return m_layerPool; }
</span><span class="cx"> 
</span><ins>+    float deviceScaleFactor() const { return m_webPage.deviceScaleFactor(); }
+
</ins><span class="cx">     LayerHostingMode layerHostingMode() const { return m_webPage.layerHostingMode(); }
</span><span class="cx"> 
</span><span class="cx">     void buildTransaction(RemoteLayerTreeTransaction&amp;, WebCore::PlatformCALayer&amp; rootLayer);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeContextmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm (173701 => 173702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm        2014-09-17 20:45:53 UTC (rev 173701)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm        2014-09-17 21:18:04 UTC (rev 173702)
</span><span class="lines">@@ -61,8 +61,10 @@
</span><span class="cx">     creationProperties.layerID = layerID;
</span><span class="cx">     creationProperties.type = type;
</span><span class="cx"> 
</span><del>-    if (layer.isPlatformCALayerRemoteCustom())
</del><ins>+    if (layer.isPlatformCALayerRemoteCustom()) {
</ins><span class="cx">         creationProperties.hostingContextID = layer.hostingContextID();
</span><ins>+        creationProperties.hostingDeviceScaleFactor = deviceScaleFactor();
+    }
</ins><span class="cx"> 
</span><span class="cx">     m_createdLayers.append(creationProperties);
</span><span class="cx">     m_liveLayers.add(layerID, &amp;layer);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessiosWebVideoFullscreenManagermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm (173701 => 173702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm        2014-09-17 20:45:53 UTC (rev 173701)
+++ trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm        2014-09-17 21:18:04 UTC (rev 173702)
</span><span class="lines">@@ -97,7 +97,7 @@
</span><span class="cx"> 
</span><span class="cx">     m_layerHostingContext = LayerHostingContext::createForExternalHostingProcess();
</span><span class="cx">     
</span><del>-    m_page-&gt;send(Messages::WebVideoFullscreenManagerProxy::SetupFullscreenWithID(m_layerHostingContext-&gt;contextID(), clientRectForElement(videoElement)), m_page-&gt;pageID());
</del><ins>+    m_page-&gt;send(Messages::WebVideoFullscreenManagerProxy::SetupFullscreenWithID(m_layerHostingContext-&gt;contextID(), clientRectForElement(videoElement), m_page-&gt;deviceScaleFactor()), m_page-&gt;pageID());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebVideoFullscreenManager::exitVideoFullscreen()
</span><span class="lines">@@ -175,10 +175,18 @@
</span><span class="cx"> 
</span><span class="cx">     [CATransaction begin];
</span><span class="cx">     [CATransaction setDisableActions:YES];
</span><ins>+
</ins><span class="cx">     [videoLayer setBackgroundColor:cachedCGColor(WebCore::Color::transparent, WebCore::ColorSpaceDeviceRGB)];
</span><ins>+
+    // Set a scale factor here to make convertRect:toLayer:nil take scale factor into account. &lt;rdar://problem/18316542&gt;.
+    // This scale factor is inverted in the hosting process.
+    float hostingScaleFactor = m_page-&gt;deviceScaleFactor();
+    [videoLayer setTransform:CATransform3DMakeScale(hostingScaleFactor, hostingScaleFactor, 1)];
</ins><span class="cx">     m_layerHostingContext-&gt;setRootLayer(videoLayer);
</span><ins>+
</ins><span class="cx">     setVideoFullscreenLayer(videoLayer);
</span><span class="cx">     [CATransaction commit];
</span><ins>+
</ins><span class="cx">     m_page-&gt;send(Messages::WebVideoFullscreenManagerProxy::EnterFullscreen(), m_page-&gt;pageID());
</span><span class="cx"> }
</span><span class="cx">     
</span></span></pre>
</div>
</div>

</body>
</html>