<!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>[213719] 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/213719">213719</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2017-03-10 11:07:13 -0800 (Fri, 10 Mar 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS WK2] Layer content blurry with nested perspective and transforms
https://bugs.webkit.org/show_bug.cgi?id=169457
Source/WebCore:

rdar://problem/29879484

Reviewed by Tim Horton.

We set rasterizationScale on CALayers to the same values as contentsScale, to
avoid blurry layers when CA rasterizes, which often happens with nested perspective
transforms.

However, in UI-side compositing, if the page is not zoomed, we never applied the
rasterizationScale in the UI process. This happened because the PlatformCALayerRemote
constructor set m_properties.contentsScale, but did not set the dirty bit that
triggers the application of contentsScale and rasterizationScale in RemoteLayerTreePropertyApplier.
The fix is to set this dirty bit.

The rest of the changes are for testing. Internals now exposes layerIDForElement()
for returns an internal (non-stable-across-loads) layerID, which can be passed
to UIScriptController.propertiesOfLayerWithID() in the UI process, which inspects
the built layer (UIView) hierarchy. propertiesOfLayerWithID() returns a dictionary
which the test can dump as JSON, or pull values out of.

A few #pragma once cleanups also.

Tests: compositing/ios/basic-layer-properties.html
       compositing/ios/rasterization-scale.html

* testing/Internals.cpp:
(WebCore::Internals::layerIDForElement):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit2:

rdar://problem/29879484

Reviewed by Tim Horton.

We set rasterizationScale on CALayers to the same values as contentsScale, to
avoid blurry layers when CA rasterizes, which often happens with nested perspective
transforms.

However, in UI-side compositing, if the page is not zoomed, we never applied the
rasterizationScale in the UI process. This happened because the PlatformCALayerRemote
constructor set m_properties.contentsScale, but did not set the dirty bit that
triggers the application of contentsScale and rasterizationScale in RemoteLayerTreePropertyApplier.
The fix is to set this dirty bit.

The rest of the changes are for testing. Internals now exposes layerIDForElement()
for returns an internal (non-stable-across-loads) layerID, which can be passed
to UIScriptController.propertiesOfLayerWithID() in the UI process, which inspects
the built layer (UIView) hierarchy. propertiesOfLayerWithID() returns a dictionary
which the test can dump as JSON, or pull values out of.

A few #pragma once cleanups also.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _propertiesOfLayerWithID:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
* UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::layerWithIDForTesting):
* UIProcess/mac/RemoteLayerTreeHost.h:
* UIProcess/mac/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::layerWithIDForTesting):
* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::PlatformCALayerRemote):

Tools:

rdar://problem/29879484

Reviewed by Tim Horton.

We set rasterizationScale on CALayers to the same values as contentsScale, to
avoid blurry layers when CA rasterizes, which often happens with nested perspective
transforms.

However, in UI-side compositing, if the page is not zoomed, we never applied the
rasterizationScale in the UI process. This happened because the PlatformCALayerRemote
constructor set m_properties.contentsScale, but did not set the dirty bit that
triggers the application of contentsScale and rasterizationScale in RemoteLayerTreePropertyApplier.
The fix is to set this dirty bit.

The rest of the changes are for testing. Internals now exposes layerIDForElement()
for returns an internal (non-stable-across-loads) layerID, which can be passed
to UIScriptController.propertiesOfLayerWithID() in the UI process, which inspects
the built layer (UIView) hierarchy. propertiesOfLayerWithID() returns a dictionary
which the test can dump as JSON, or pull values out of.

A few #pragma once cleanups also.

* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::propertiesOfLayerWithID):
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::propertiesOfLayerWithID):
* TestRunnerShared/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::propertiesOfLayerWithID):

LayoutTests:

Reviewed by Tim Horton.

We set rasterizationScale on CALayers to the same values as contentsScale, to
avoid blurry layers when CA rasterizes, which often happens with nested perspective
transforms.

However, in UI-side compositing, if the page is not zoomed, we never applied the
rasterizationScale in the UI process. This happened because the PlatformCALayerRemote
constructor set m_properties.contentsScale, but did not set the dirty bit that
triggers the application of contentsScale and rasterizationScale in RemoteLayerTreePropertyApplier.
The fix is to set this dirty bit.

The rest of the changes are for testing. Internals now exposes layerIDForElement()
for returns an internal (non-stable-across-loads) layerID, which can be passed
to UIScriptController.propertiesOfLayerWithID() in the UI process, which inspects
the built layer (UIView) hierarchy. propertiesOfLayerWithID() returns a dictionary
which the test can dump as JSON, or pull values out of.

A few #pragma once cleanups also.

* TestExpectations:
* compositing/ios/basic-layer-properties-expected.txt: Added.
* compositing/ios/basic-layer-properties.html: Added.
* compositing/ios/rasterization-scale-expected.txt: Added.
* compositing/ios/rasterization-scale.html: Added.
* platform/ios-simulator-wk2/TestExpectations:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsTestExpectations">trunk/LayoutTests/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorwk2TestExpectations">trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoretestingInternalscpp">trunk/Source/WebCore/testing/Internals.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalsh">trunk/Source/WebCore/testing/Internals.h</a></li>
<li><a href="#trunkSourceWebCoretestingInternalsidl">trunk/Source/WebCore/testing/Internals.idl</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedmacRemoteLayerTreePropertyApplierh">trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacRemoteLayerTreeDrawingAreaProxyh">trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacRemoteLayerTreeDrawingAreaProxymm">trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacRemoteLayerTreeHosth">trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacRemoteLayerTreeHostmm">trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacPlatformCALayerRemotecpp">trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreeiosUIScriptControllerIOSmm">trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm</a></li>
<li><a href="#trunkToolsTestRunnerSharedUIScriptContextBindingsUIScriptControlleridl">trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl</a></li>
<li><a href="#trunkToolsTestRunnerSharedUIScriptContextUIScriptControllercpp">trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp</a></li>
<li><a href="#trunkToolsTestRunnerSharedUIScriptContextUIScriptControllerh">trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h</a></li>
<li><a href="#trunkToolsWebKitTestRunneriosUIScriptControllerIOSmm">trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/compositing/ios/</li>
<li><a href="#trunkLayoutTestscompositingiosbasiclayerpropertiesexpectedtxt">trunk/LayoutTests/compositing/ios/basic-layer-properties-expected.txt</a></li>
<li><a href="#trunkLayoutTestscompositingiosbasiclayerpropertieshtml">trunk/LayoutTests/compositing/ios/basic-layer-properties.html</a></li>
<li><a href="#trunkLayoutTestscompositingiosrasterizationscaleexpectedtxt">trunk/LayoutTests/compositing/ios/rasterization-scale-expected.txt</a></li>
<li><a href="#trunkLayoutTestscompositingiosrasterizationscalehtml">trunk/LayoutTests/compositing/ios/rasterization-scale.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (213718 => 213719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-03-10 19:01:57 UTC (rev 213718)
+++ trunk/LayoutTests/ChangeLog        2017-03-10 19:07:13 UTC (rev 213719)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2017-03-09  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        [iOS WK2] Layer content blurry with nested perspective and transforms
+        https://bugs.webkit.org/show_bug.cgi?id=169457
+
+        Reviewed by Tim Horton.
+
+        We set rasterizationScale on CALayers to the same values as contentsScale, to
+        avoid blurry layers when CA rasterizes, which often happens with nested perspective
+        transforms.
+        
+        However, in UI-side compositing, if the page is not zoomed, we never applied the
+        rasterizationScale in the UI process. This happened because the PlatformCALayerRemote
+        constructor set m_properties.contentsScale, but did not set the dirty bit that
+        triggers the application of contentsScale and rasterizationScale in RemoteLayerTreePropertyApplier.
+        The fix is to set this dirty bit.
+        
+        The rest of the changes are for testing. Internals now exposes layerIDForElement()
+        for returns an internal (non-stable-across-loads) layerID, which can be passed
+        to UIScriptController.propertiesOfLayerWithID() in the UI process, which inspects
+        the built layer (UIView) hierarchy. propertiesOfLayerWithID() returns a dictionary
+        which the test can dump as JSON, or pull values out of.
+        
+        A few #pragma once cleanups also.
+
+        * TestExpectations:
+        * compositing/ios/basic-layer-properties-expected.txt: Added.
+        * compositing/ios/basic-layer-properties.html: Added.
+        * compositing/ios/rasterization-scale-expected.txt: Added.
+        * compositing/ios/rasterization-scale.html: Added.
+        * platform/ios-simulator-wk2/TestExpectations:
+
</ins><span class="cx"> 2017-03-10  Javier Fernandez  &lt;jfernandez@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Unreviewed test gardening
</span></span></pre></div>
<a id="trunkLayoutTestsTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/TestExpectations (213718 => 213719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/TestExpectations        2017-03-10 19:01:57 UTC (rev 213718)
+++ trunk/LayoutTests/TestExpectations        2017-03-10 19:07:13 UTC (rev 213719)
</span><span class="lines">@@ -6,6 +6,7 @@
</span><span class="cx"> # Platform-specific tests. Skipped here, then re-enabled on the appropriate platform.
</span><span class="cx"> #//////////////////////////////////////////////////////////////////////////////////////////
</span><span class="cx"> 
</span><ins>+compositing/ios [ Skip ]
</ins><span class="cx"> css3/touch-action [ Skip ]
</span><span class="cx"> accessibility/ios-simulator [ Skip ]
</span><span class="cx"> accessibility/gtk [ Skip ]
</span></span></pre></div>
<a id="trunkLayoutTestscompositingiosbasiclayerpropertiesexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/ios/basic-layer-properties-expected.txt (0 => 213719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/ios/basic-layer-properties-expected.txt                                (rev 0)
+++ trunk/LayoutTests/compositing/ios/basic-layer-properties-expected.txt        2017-03-10 19:07:13 UTC (rev 213719)
</span><span class="lines">@@ -0,0 +1,62 @@
</span><ins>+Composited box.
+{
+    &quot;anchorPoint&quot;: {
+        &quot;x&quot;: 0.5,
+        &quot;y&quot;: 0.5
+    },
+    &quot;anchorPointZ&quot;: 0,
+    &quot;bounds&quot;: {
+        &quot;height&quot;: 148,
+        &quot;width&quot;: 148,
+        &quot;x&quot;: 0,
+        &quot;y&quot;: 0
+    },
+    &quot;contentsScale&quot;: 2,
+    &quot;doubleSided&quot;: true,
+    &quot;hidden&quot;: false,
+    &quot;masksToBounds&quot;: false,
+    &quot;opacity&quot;: 1,
+    &quot;opaque&quot;: true,
+    &quot;position&quot;: {
+        &quot;x&quot;: 88,
+        &quot;y&quot;: 80
+    },
+    &quot;rasterizationScale&quot;: 2,
+    &quot;sublayerTransform&quot;: {
+        &quot;m11&quot;: 1,
+        &quot;m12&quot;: 0,
+        &quot;m13&quot;: 0,
+        &quot;m14&quot;: 0,
+        &quot;m21&quot;: 0,
+        &quot;m22&quot;: 1,
+        &quot;m23&quot;: 0,
+        &quot;m24&quot;: 0,
+        &quot;m31&quot;: 0,
+        &quot;m32&quot;: 0,
+        &quot;m33&quot;: 1,
+        &quot;m34&quot;: 0,
+        &quot;m41&quot;: 0,
+        &quot;m42&quot;: 0,
+        &quot;m43&quot;: 0,
+        &quot;m44&quot;: 1
+    },
+    &quot;transform&quot;: {
+        &quot;m11&quot;: 1,
+        &quot;m12&quot;: 0,
+        &quot;m13&quot;: 0,
+        &quot;m14&quot;: 0,
+        &quot;m21&quot;: 0,
+        &quot;m22&quot;: 1,
+        &quot;m23&quot;: 0,
+        &quot;m24&quot;: 0,
+        &quot;m31&quot;: 0,
+        &quot;m32&quot;: 0,
+        &quot;m33&quot;: 1,
+        &quot;m34&quot;: 0,
+        &quot;m41&quot;: 0,
+        &quot;m42&quot;: 0,
+        &quot;m43&quot;: 0,
+        &quot;m44&quot;: 1
+    },
+    &quot;zPosition&quot;: 0
+}
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingiosbasiclayerpropertieshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/ios/basic-layer-properties.html (0 => 213719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/ios/basic-layer-properties.html                                (rev 0)
+++ trunk/LayoutTests/compositing/ios/basic-layer-properties.html        2017-03-10 19:07:13 UTC (rev 213719)
</span><span class="lines">@@ -0,0 +1,87 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+    &lt;style&gt;
+        .box {
+            height: 100px;
+            width: 100px;
+            background-color: silver;
+            box-shadow: 0 0 10px black;
+            padding: 10px;
+            margin: 20px;
+        }
+        
+        .composited {
+            will-change: transform;
+        }
+    &lt;/style&gt;
+    &lt;script&gt;
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+
+        function sortedJSONStringify(object, space)
+        {
+            function sorted(o)
+            {
+                var result = {};
+                
+                var keys = [];
+                for (var key in o) {
+                    if (o.hasOwnProperty(key))
+                        keys.push(key);
+                }
+                
+                keys.sort();
+                for (var key of keys)
+                    result[key] = o[key];
+                
+                return result;
+            }
+            
+            return JSON.stringify(sorted(object), function(key, value) {
+                if (typeof value === 'object' &amp;&amp; !Array.isArray(value) &amp;&amp; !(typeof(value) === 'function'))
+                    return sorted(value);
+                return value;
+            }, space);
+        }
+        
+        function getUIScript(layerID)
+        {
+            return `
+                (function() {
+                    uiController.doAfterPresentationUpdate(function() {
+                        var layerProperties = JSON.stringify(uiController.propertiesOfLayerWithID(${layerID}));
+                        uiController.uiScriptComplete(layerProperties);
+                    })
+                })();`
+        }
+
+        function doTest()
+        {
+            if (!window.testRunner)
+                return;
+
+            var layerID = internals.layerIDForElement(document.getElementById('composited'));
+
+            testRunner.runUIScript(getUIScript(layerID), function(layerProperties) {
+                var propertiesAsJSON = JSON.parse(layerProperties);
+                document.getElementById('layer-properties').textContent = sortedJSONStringify(propertiesAsJSON, 4);
+                testRunner.notifyDone();
+            });
+        }
+        
+        window.addEventListener('load', doTest, false);
+    &lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;div id=&quot;composited&quot; class=&quot;composited box&quot;&gt;
+    Composited box.
+&lt;/div&gt;
+
+&lt;pre id=&quot;layer-properties&quot;&gt;&lt;/pre&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingiosrasterizationscaleexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/ios/rasterization-scale-expected.txt (0 => 213719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/ios/rasterization-scale-expected.txt                                (rev 0)
+++ trunk/LayoutTests/compositing/ios/rasterization-scale-expected.txt        2017-03-10 19:07:13 UTC (rev 213719)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+This text should not be blurry
+rasterizationScale of layer is 2
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingiosrasterizationscalehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/ios/rasterization-scale.html (0 => 213719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/ios/rasterization-scale.html                                (rev 0)
+++ trunk/LayoutTests/compositing/ios/rasterization-scale.html        2017-03-10 19:07:13 UTC (rev 213719)
</span><span class="lines">@@ -0,0 +1,80 @@
</span><ins>+&lt;!DOCTYPE html&gt; &lt;!-- webkit-test-runner [ useFlexibleViewport=true ] --&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width&quot;&gt;
+    &lt;style&gt;
+        .perspective-container {
+            perspective: 1500px;
+            width: 100%;
+            padding: 10px;
+            border: 1px solid black;
+        }
+        
+        .container {
+            transform: translateZ(20px);
+        }
+        
+        .middle {
+            transform-style: preserve-3d;
+            perspective: 300px;
+        }
+        
+        #blurry-layer {
+            width: 100%;
+            height: 50px;
+            -webkit-backface-visibility: hidden;
+            transform: rotateX(20deg);
+            background-color: silver;
+            font-size: 24pt;
+        }
+    &lt;/style&gt;
+    &lt;script&gt;
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+
+        function getUIScript(layerID)
+        {
+            return `
+                (function() {
+                    uiController.doAfterPresentationUpdate(function() {
+                        var layerProperties = JSON.stringify(uiController.propertiesOfLayerWithID(${layerID}));
+                        uiController.uiScriptComplete(layerProperties);
+                    })
+                })();`
+        }
+
+        function doTest()
+        {
+            if (!window.testRunner)
+                return;
+
+            var layerID = internals.layerIDForElement(document.getElementById('blurry-layer'));
+
+            testRunner.runUIScript(getUIScript(layerID), function(layerProperties) {
+                var propertiesAsJSON = JSON.parse(layerProperties);
+                document.getElementById('layer-properties').textContent = 'rasterizationScale of layer is ' + propertiesAsJSON['rasterizationScale'];
+                testRunner.notifyDone();
+            });
+        }
+        
+        window.addEventListener('load', doTest, false);
+    &lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;div class=&quot;perspective-container&quot;&gt;
+    &lt;div class=&quot;container&quot;&gt;
+        &lt;div class=&quot;middle&quot;&gt;
+            &lt;div id=&quot;blurry-layer&quot;&gt;
+                This text should not be blurry
+            &lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+&lt;/div&gt;
+
+&lt;pre id=&quot;layer-properties&quot;&gt;&lt;/pre&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorwk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations (213718 => 213719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations        2017-03-10 19:01:57 UTC (rev 213718)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations        2017-03-10 19:07:13 UTC (rev 213719)
</span><span class="lines">@@ -6,6 +6,7 @@
</span><span class="cx"> # Platform-specific directories. Skipped globally, then re-enabled here.
</span><span class="cx"> #//////////////////////////////////////////////////////////////////////////////////////////
</span><span class="cx"> 
</span><ins>+compositing/ios [ Pass ]
</ins><span class="cx"> fast/history/ios [ Pass ]
</span><span class="cx"> fast/scrolling/ios [ Pass ]
</span><span class="cx"> fast/viewport/ios [ Pass ]
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (213718 => 213719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-03-10 19:01:57 UTC (rev 213718)
+++ trunk/Source/WebCore/ChangeLog        2017-03-10 19:07:13 UTC (rev 213719)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2017-03-09  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        [iOS WK2] Layer content blurry with nested perspective and transforms
+        https://bugs.webkit.org/show_bug.cgi?id=169457
+        rdar://problem/29879484
+
+        Reviewed by Tim Horton.
+
+        We set rasterizationScale on CALayers to the same values as contentsScale, to
+        avoid blurry layers when CA rasterizes, which often happens with nested perspective
+        transforms.
+        
+        However, in UI-side compositing, if the page is not zoomed, we never applied the
+        rasterizationScale in the UI process. This happened because the PlatformCALayerRemote
+        constructor set m_properties.contentsScale, but did not set the dirty bit that
+        triggers the application of contentsScale and rasterizationScale in RemoteLayerTreePropertyApplier.
+        The fix is to set this dirty bit.
+        
+        The rest of the changes are for testing. Internals now exposes layerIDForElement()
+        for returns an internal (non-stable-across-loads) layerID, which can be passed
+        to UIScriptController.propertiesOfLayerWithID() in the UI process, which inspects
+        the built layer (UIView) hierarchy. propertiesOfLayerWithID() returns a dictionary
+        which the test can dump as JSON, or pull values out of.
+
+        A few #pragma once cleanups also.
+
+        Tests: compositing/ios/basic-layer-properties.html
+               compositing/ios/rasterization-scale.html
+
+        * testing/Internals.cpp:
+        (WebCore::Internals::layerIDForElement):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
</ins><span class="cx"> 2017-03-10  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r213618.
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.cpp (213718 => 213719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.cpp        2017-03-10 19:01:57 UTC (rev 213718)
+++ trunk/Source/WebCore/testing/Internals.cpp        2017-03-10 19:07:13 UTC (rev 213719)
</span><span class="lines">@@ -2149,6 +2149,23 @@
</span><span class="cx">     return document.frame()-&gt;layerTreeAsText(toLayerTreeFlags(flags));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+ExceptionOr&lt;uint64_t&gt; Internals::layerIDForElement(Element&amp; element)
+{
+    Document* document = contextDocument();
+    if (!document || !document-&gt;frame())
+        return Exception { INVALID_ACCESS_ERR };
+
+    if (!element.renderer() || !element.renderer()-&gt;hasLayer())
+        return Exception { NOT_FOUND_ERR };
+
+    auto&amp; layerModelObject = downcast&lt;RenderLayerModelObject&gt;(*element.renderer());
+    if (!layerModelObject.layer()-&gt;isComposited())
+        return Exception { NOT_FOUND_ERR };
+    
+    auto* backing = layerModelObject.layer()-&gt;backing();
+    return backing-&gt;graphicsLayer()-&gt;primaryLayerID();
+}
+
</ins><span class="cx"> ExceptionOr&lt;String&gt; Internals::repaintRectsAsText() const
</span><span class="cx"> {
</span><span class="cx">     Document* document = contextDocument();
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.h (213718 => 213719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.h        2017-03-10 19:01:57 UTC (rev 213718)
+++ trunk/Source/WebCore/testing/Internals.h        2017-03-10 19:07:13 UTC (rev 213719)
</span><span class="lines">@@ -274,6 +274,7 @@
</span><span class="cx">         LAYER_TREE_INCLUDES_ACCELERATES_DRAWING = 32,
</span><span class="cx">     };
</span><span class="cx">     ExceptionOr&lt;String&gt; layerTreeAsText(Document&amp;, unsigned short flags) const;
</span><ins>+    ExceptionOr&lt;uint64_t&gt; layerIDForElement(Element&amp;);
</ins><span class="cx">     ExceptionOr&lt;String&gt; repaintRectsAsText() const;
</span><span class="cx">     ExceptionOr&lt;String&gt; scrollingStateTreeAsText() const;
</span><span class="cx">     ExceptionOr&lt;String&gt; mainThreadScrollingReasons() const;
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.idl (213718 => 213719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.idl        2017-03-10 19:01:57 UTC (rev 213718)
+++ trunk/Source/WebCore/testing/Internals.idl        2017-03-10 19:07:13 UTC (rev 213719)
</span><span class="lines">@@ -260,6 +260,8 @@
</span><span class="cx">     const unsigned short LAYER_TREE_INCLUDES_ACCELERATES_DRAWING = 32;
</span><span class="cx">     [MayThrowException] DOMString layerTreeAsText(Document document, optional unsigned short flags = 0);
</span><span class="cx"> 
</span><ins>+    [MayThrowException] unsigned long long layerIDForElement(Element element);
+
</ins><span class="cx">     [MayThrowException] DOMString scrollingStateTreeAsText();
</span><span class="cx">     [MayThrowException] DOMString mainThreadScrollingReasons(); // FIXME: rename to synchronousScrollingReasons().
</span><span class="cx">     [MayThrowException] ClientRectList? nonFastScrollableRects();
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (213718 => 213719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2017-03-10 19:01:57 UTC (rev 213718)
+++ trunk/Source/WebKit2/ChangeLog        2017-03-10 19:07:13 UTC (rev 213719)
</span><span class="lines">@@ -1,3 +1,41 @@
</span><ins>+2017-03-09  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        [iOS WK2] Layer content blurry with nested perspective and transforms
+        https://bugs.webkit.org/show_bug.cgi?id=169457
+        rdar://problem/29879484
+
+        Reviewed by Tim Horton.
+        
+        We set rasterizationScale on CALayers to the same values as contentsScale, to
+        avoid blurry layers when CA rasterizes, which often happens with nested perspective
+        transforms.
+        
+        However, in UI-side compositing, if the page is not zoomed, we never applied the
+        rasterizationScale in the UI process. This happened because the PlatformCALayerRemote
+        constructor set m_properties.contentsScale, but did not set the dirty bit that
+        triggers the application of contentsScale and rasterizationScale in RemoteLayerTreePropertyApplier.
+        The fix is to set this dirty bit.
+        
+        The rest of the changes are for testing. Internals now exposes layerIDForElement()
+        for returns an internal (non-stable-across-loads) layerID, which can be passed
+        to UIScriptController.propertiesOfLayerWithID() in the UI process, which inspects
+        the built layer (UIView) hierarchy. propertiesOfLayerWithID() returns a dictionary
+        which the test can dump as JSON, or pull values out of.
+        
+        A few #pragma once cleanups also.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _propertiesOfLayerWithID:]):
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+        * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
+        * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
+        (WebKit::RemoteLayerTreeDrawingAreaProxy::layerWithIDForTesting):
+        * UIProcess/mac/RemoteLayerTreeHost.h:
+        * UIProcess/mac/RemoteLayerTreeHost.mm:
+        (WebKit::RemoteLayerTreeHost::layerWithIDForTesting):
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+        (WebKit::PlatformCALayerRemote::PlatformCALayerRemote):
+
</ins><span class="cx"> 2017-03-10  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r213618.
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacRemoteLayerTreePropertyApplierh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.h (213718 => 213719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.h        2017-03-10 19:01:57 UTC (rev 213718)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.h        2017-03-10 19:07:13 UTC (rev 213719)
</span><span class="lines">@@ -23,8 +23,7 @@
</span><span class="cx">  * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef RemoteLayerTreePropertyApplier_h
-#define RemoteLayerTreePropertyApplier_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;LayerRepresentation.h&quot;
</span><span class="cx"> #include &quot;RemoteLayerTreeTransaction.h&quot;
</span><span class="lines">@@ -44,5 +43,3 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span><del>-
-#endif // RemoteLayerTreePropertyApplier_h
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (213718 => 213719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2017-03-10 19:01:57 UTC (rev 213718)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2017-03-10 19:07:13 UTC (rev 213719)
</span><span class="lines">@@ -5154,6 +5154,83 @@
</span><span class="cx">     }];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (NSDictionary *)_propertiesOfLayerWithID:(unsigned long long)layerID
+{
+    CALayer* layer = asLayer(downcast&lt;WebKit::RemoteLayerTreeDrawingAreaProxy&gt;(*_page-&gt;drawingArea()).layerWithIDForTesting(layerID));
+    if (!layer)
+        return nil;
+
+    return @{
+        @&quot;bounds&quot; : @{
+            @&quot;x&quot; : @(layer.bounds.origin.x),
+            @&quot;y&quot; : @(layer.bounds.origin.x),
+            @&quot;width&quot; : @(layer.bounds.size.width),
+            @&quot;height&quot; : @(layer.bounds.size.height),
+
+        },
+        @&quot;position&quot; : @{
+            @&quot;x&quot; : @(layer.position.x),
+            @&quot;y&quot; : @(layer.position.y),
+        },
+        @&quot;zPosition&quot; : @(layer.zPosition),
+        @&quot;anchorPoint&quot; : @{
+            @&quot;x&quot; : @(layer.anchorPoint.x),
+            @&quot;y&quot; : @(layer.anchorPoint.y),
+        },
+        @&quot;anchorPointZ&quot; : @(layer.anchorPointZ),
+        @&quot;transform&quot; : @{
+            @&quot;m11&quot; : @(layer.transform.m11),
+            @&quot;m12&quot; : @(layer.transform.m12),
+            @&quot;m13&quot; : @(layer.transform.m13),
+            @&quot;m14&quot; : @(layer.transform.m14),
+
+            @&quot;m21&quot; : @(layer.transform.m21),
+            @&quot;m22&quot; : @(layer.transform.m22),
+            @&quot;m23&quot; : @(layer.transform.m23),
+            @&quot;m24&quot; : @(layer.transform.m24),
+
+            @&quot;m31&quot; : @(layer.transform.m31),
+            @&quot;m32&quot; : @(layer.transform.m32),
+            @&quot;m33&quot; : @(layer.transform.m33),
+            @&quot;m34&quot; : @(layer.transform.m34),
+
+            @&quot;m41&quot; : @(layer.transform.m41),
+            @&quot;m42&quot; : @(layer.transform.m42),
+            @&quot;m43&quot; : @(layer.transform.m43),
+            @&quot;m44&quot; : @(layer.transform.m44),
+        },
+        @&quot;sublayerTransform&quot; : @{
+            @&quot;m11&quot; : @(layer.sublayerTransform.m11),
+            @&quot;m12&quot; : @(layer.sublayerTransform.m12),
+            @&quot;m13&quot; : @(layer.sublayerTransform.m13),
+            @&quot;m14&quot; : @(layer.sublayerTransform.m14),
+
+            @&quot;m21&quot; : @(layer.sublayerTransform.m21),
+            @&quot;m22&quot; : @(layer.sublayerTransform.m22),
+            @&quot;m23&quot; : @(layer.sublayerTransform.m23),
+            @&quot;m24&quot; : @(layer.sublayerTransform.m24),
+
+            @&quot;m31&quot; : @(layer.sublayerTransform.m31),
+            @&quot;m32&quot; : @(layer.sublayerTransform.m32),
+            @&quot;m33&quot; : @(layer.sublayerTransform.m33),
+            @&quot;m34&quot; : @(layer.sublayerTransform.m34),
+
+            @&quot;m41&quot; : @(layer.sublayerTransform.m41),
+            @&quot;m42&quot; : @(layer.sublayerTransform.m42),
+            @&quot;m43&quot; : @(layer.sublayerTransform.m43),
+            @&quot;m44&quot; : @(layer.sublayerTransform.m44),
+        },
+        
+        @&quot;hidden&quot; : @(layer.hidden),
+        @&quot;doubleSided&quot; : @(layer.doubleSided),
+        @&quot;masksToBounds&quot; : @(layer.masksToBounds),
+        @&quot;contentsScale&quot; : @(layer.contentsScale),
+        @&quot;rasterizationScale&quot; : @(layer.rasterizationScale),
+        @&quot;opaque&quot; : @(layer.opaque),
+        @&quot;opacity&quot; : @(layer.opacity),
+    };
+}
+
</ins><span class="cx"> #endif // PLATFORM(IOS)
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (213718 => 213719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2017-03-10 19:01:57 UTC (rev 213718)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2017-03-10 19:07:13 UTC (rev 213719)
</span><span class="lines">@@ -312,6 +312,8 @@
</span><span class="cx"> 
</span><span class="cx"> @property (nonatomic, readonly) NSNumber *_stableStateOverride WK_API_AVAILABLE(ios(WK_IOS_TBA));
</span><span class="cx"> 
</span><ins>+- (NSDictionary *)_propertiesOfLayerWithID:(unsigned long long)layerID WK_API_AVAILABLE(ios(WK_IOS_TBA));
+
</ins><span class="cx"> - (void)_simulateDataInteractionEntered:(id)info WK_API_AVAILABLE(ios(WK_IOS_TBA));
</span><span class="cx"> - (void)_simulateDataInteractionUpdated:(id)info WK_API_AVAILABLE(ios(WK_IOS_TBA));
</span><span class="cx"> - (void)_simulateDataInteractionPerformOperation:(id)info WK_API_AVAILABLE(ios(WK_IOS_TBA));
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacRemoteLayerTreeDrawingAreaProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h (213718 => 213719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h        2017-03-10 19:01:57 UTC (rev 213718)
+++ trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h        2017-03-10 19:07:13 UTC (rev 213719)
</span><span class="lines">@@ -23,8 +23,7 @@
</span><span class="cx">  * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef RemoteLayerTreeDrawingAreaProxy_h
-#define RemoteLayerTreeDrawingAreaProxy_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;DrawingAreaProxy.h&quot;
</span><span class="cx"> #include &quot;RemoteLayerTreeHost.h&quot;
</span><span class="lines">@@ -58,6 +57,8 @@
</span><span class="cx"> 
</span><span class="cx">     bool isAlwaysOnLoggingAllowed() const;
</span><span class="cx"> 
</span><ins>+    LayerOrView* layerWithIDForTesting(uint64_t) const;
+
</ins><span class="cx"> private:
</span><span class="cx">     void sizeDidChange() override;
</span><span class="cx">     void deviceScaleFactorDidChange() override;
</span><span class="lines">@@ -119,5 +120,3 @@
</span><span class="cx"> } // namespace WebKit
</span><span class="cx"> 
</span><span class="cx"> SPECIALIZE_TYPE_TRAITS_DRAWING_AREA_PROXY(RemoteLayerTreeDrawingAreaProxy, DrawingAreaTypeRemoteLayerTree)
</span><del>-
-#endif // RemoteLayerTreeDrawingAreaProxy_h
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacRemoteLayerTreeDrawingAreaProxymm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm (213718 => 213719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm        2017-03-10 19:01:57 UTC (rev 213718)
+++ trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm        2017-03-10 19:07:13 UTC (rev 213719)
</span><span class="lines">@@ -478,4 +478,9 @@
</span><span class="cx">     return m_webPageProxy.isAlwaysOnLoggingAllowed();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+LayerOrView* RemoteLayerTreeDrawingAreaProxy::layerWithIDForTesting(uint64_t layerID) const
+{
+    return m_remoteLayerTreeHost.layerWithIDForTesting(layerID);
+}
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacRemoteLayerTreeHosth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.h (213718 => 213719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.h        2017-03-10 19:01:57 UTC (rev 213718)
+++ trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.h        2017-03-10 19:07:13 UTC (rev 213719)
</span><span class="lines">@@ -23,8 +23,7 @@
</span><span class="cx">  * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef RemoteLayerTreeHost_h
-#define RemoteLayerTreeHost_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;LayerRepresentation.h&quot;
</span><span class="cx"> #include &quot;RemoteLayerTreeTransaction.h&quot;
</span><span class="lines">@@ -71,6 +70,8 @@
</span><span class="cx">     // This avoids keeping an outstanding InUse reference when suspended.
</span><span class="cx">     void mapAllIOSurfaceBackingStore();
</span><span class="cx"> 
</span><ins>+    LayerOrView* layerWithIDForTesting(uint64_t) const;
+
</ins><span class="cx"> private:
</span><span class="cx">     LayerOrView *createLayer(const RemoteLayerTreeTransaction::LayerCreationProperties&amp;, const RemoteLayerTreeTransaction::LayerProperties*);
</span><span class="cx">     static void setLayerID(CALayer *, WebCore::GraphicsLayer::PlatformLayerID);
</span><span class="lines">@@ -85,5 +86,3 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span><del>-
-#endif // RemoteLayerTreeHost_h
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacRemoteLayerTreeHostmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm (213718 => 213719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm        2017-03-10 19:01:57 UTC (rev 213718)
+++ trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm        2017-03-10 19:07:13 UTC (rev 213719)
</span><span class="lines">@@ -204,6 +204,11 @@
</span><span class="cx">     m_rootLayer = nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+LayerOrView* RemoteLayerTreeHost::layerWithIDForTesting(uint64_t layerID) const
+{
+    return getLayer(layerID);
+}
+
</ins><span class="cx"> static NSString* const WKLayerIDPropertyKey = @&quot;WKLayerID&quot;;
</span><span class="cx"> 
</span><span class="cx"> void RemoteLayerTreeHost::setLayerID(CALayer *layer, WebCore::GraphicsLayer::PlatformLayerID layerID)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacPlatformCALayerRemotecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp (213718 => 213719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp        2017-03-10 19:01:57 UTC (rev 213718)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp        2017-03-10 19:07:13 UTC (rev 213719)
</span><span class="lines">@@ -76,8 +76,10 @@
</span><span class="cx">     : PlatformCALayer(layerType, owner)
</span><span class="cx">     , m_context(&amp;context)
</span><span class="cx"> {
</span><del>-    if (owner)
</del><ins>+    if (owner) {
</ins><span class="cx">         m_properties.contentsScale = owner-&gt;platformCALayerDeviceScaleFactor();
</span><ins>+        m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ContentsScaleChanged);
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> PlatformCALayerRemote::PlatformCALayerRemote(const PlatformCALayerRemote&amp; other, PlatformCALayerClient* owner, RemoteLayerTreeContext&amp; context)
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (213718 => 213719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2017-03-10 19:01:57 UTC (rev 213718)
+++ trunk/Tools/ChangeLog        2017-03-10 19:07:13 UTC (rev 213719)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2017-03-09  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        [iOS WK2] Layer content blurry with nested perspective and transforms
+        https://bugs.webkit.org/show_bug.cgi?id=169457
+        rdar://problem/29879484
+
+        Reviewed by Tim Horton.
+
+        We set rasterizationScale on CALayers to the same values as contentsScale, to
+        avoid blurry layers when CA rasterizes, which often happens with nested perspective
+        transforms.
+
+        However, in UI-side compositing, if the page is not zoomed, we never applied the
+        rasterizationScale in the UI process. This happened because the PlatformCALayerRemote
+        constructor set m_properties.contentsScale, but did not set the dirty bit that
+        triggers the application of contentsScale and rasterizationScale in RemoteLayerTreePropertyApplier.
+        The fix is to set this dirty bit.
+
+        The rest of the changes are for testing. Internals now exposes layerIDForElement()
+        for returns an internal (non-stable-across-loads) layerID, which can be passed
+        to UIScriptController.propertiesOfLayerWithID() in the UI process, which inspects
+        the built layer (UIView) hierarchy. propertiesOfLayerWithID() returns a dictionary
+        which the test can dump as JSON, or pull values out of.
+
+        A few #pragma once cleanups also.
+
+        * DumpRenderTree/ios/UIScriptControllerIOS.mm:
+        (WTR::UIScriptController::propertiesOfLayerWithID):
+        * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
+        * TestRunnerShared/UIScriptContext/UIScriptController.cpp:
+        (WTR::UIScriptController::propertiesOfLayerWithID):
+        * TestRunnerShared/UIScriptContext/UIScriptController.h:
+        * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+        (WTR::UIScriptController::propertiesOfLayerWithID):
+
</ins><span class="cx"> 2017-03-10  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r213618.
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeiosUIScriptControllerIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm (213718 => 213719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm        2017-03-10 19:01:57 UTC (rev 213718)
+++ trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm        2017-03-10 19:07:13 UTC (rev 213719)
</span><span class="lines">@@ -294,6 +294,11 @@
</span><span class="cx">     return nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+JSObjectRef UIScriptController::propertiesOfLayerWithID(uint64_t layerID) const
+{
+    return nullptr;
+}
+
</ins><span class="cx"> void UIScriptController::retrieveSpeakSelectionContent(JSValueRef)
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsTestRunnerSharedUIScriptContextBindingsUIScriptControlleridl"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl (213718 => 213719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl        2017-03-10 19:01:57 UTC (rev 213718)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl        2017-03-10 19:07:13 UTC (rev 213719)
</span><span class="lines">@@ -217,6 +217,8 @@
</span><span class="cx"> 
</span><span class="cx">     readonly attribute DOMString scrollingTreeAsText;
</span><span class="cx"> 
</span><ins>+    object propertiesOfLayerWithID(unsigned long long layerID);
+
</ins><span class="cx">     void retrieveSpeakSelectionContent(object callback);
</span><span class="cx">     readonly attribute DOMString accessibilitySpeakSelectionContent;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsTestRunnerSharedUIScriptContextUIScriptControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp (213718 => 213719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp        2017-03-10 19:01:57 UTC (rev 213718)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp        2017-03-10 19:07:13 UTC (rev 213719)
</span><span class="lines">@@ -340,6 +340,11 @@
</span><span class="cx">     return nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+JSObjectRef UIScriptController::propertiesOfLayerWithID(uint64_t layerID) const
+{
+    return nullptr;
+}
+
</ins><span class="cx"> void UIScriptController::platformSetDidStartFormControlInteractionCallback()
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsTestRunnerSharedUIScriptContextUIScriptControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h (213718 => 213719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h        2017-03-10 19:01:57 UTC (rev 213718)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h        2017-03-10 19:07:13 UTC (rev 213719)
</span><span class="lines">@@ -140,6 +140,8 @@
</span><span class="cx">     
</span><span class="cx">     JSRetainPtr&lt;JSStringRef&gt; scrollingTreeAsText() const;
</span><span class="cx"> 
</span><ins>+    JSObjectRef propertiesOfLayerWithID(uint64_t layerID) const;
+
</ins><span class="cx">     void uiScriptComplete(JSStringRef result);
</span><span class="cx">     
</span><span class="cx">     void retrieveSpeakSelectionContent(JSValueRef);
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunneriosUIScriptControllerIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (213718 => 213719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm        2017-03-10 19:01:57 UTC (rev 213718)
+++ trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm        2017-03-10 19:07:13 UTC (rev 213719)
</span><span class="lines">@@ -548,6 +548,11 @@
</span><span class="cx">     return JSStringCreateWithCFString((CFStringRef)[webView _scrollingTreeAsText]);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+JSObjectRef UIScriptController::propertiesOfLayerWithID(uint64_t layerID) const
+{
+    return JSValueToObject(m_context-&gt;jsContext(), [JSValue valueWithObject:[TestController::singleton().mainWebView()-&gt;platformView() _propertiesOfLayerWithID:layerID] inContext:[JSContext contextWithJSGlobalContextRef:m_context-&gt;jsContext()]].JSValueRef, nullptr);
+}
+
</ins><span class="cx"> void UIScriptController::removeViewFromWindow(JSValueRef callback)
</span><span class="cx"> {
</span><span class="cx">     TestController::singleton().mainWebView()-&gt;removeFromWindow();
</span></span></pre>
</div>
</div>

</body>
</html>