Title: [213719] trunk
Revision
213719
Author
simon.fra...@apple.com
Date
2017-03-10 11:07:13 -0800 (Fri, 10 Mar 2017)

Log Message

[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:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (213718 => 213719)


--- trunk/LayoutTests/ChangeLog	2017-03-10 19:01:57 UTC (rev 213718)
+++ trunk/LayoutTests/ChangeLog	2017-03-10 19:07:13 UTC (rev 213719)
@@ -1,3 +1,35 @@
+2017-03-09  Simon Fraser  <simon.fra...@apple.com>
+
+        [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:
+
 2017-03-10  Javier Fernandez  <jfernan...@igalia.com>
 
         [GTK] Unreviewed test gardening

Modified: trunk/LayoutTests/TestExpectations (213718 => 213719)


--- trunk/LayoutTests/TestExpectations	2017-03-10 19:01:57 UTC (rev 213718)
+++ trunk/LayoutTests/TestExpectations	2017-03-10 19:07:13 UTC (rev 213719)
@@ -6,6 +6,7 @@
 # Platform-specific tests. Skipped here, then re-enabled on the appropriate platform.
 #//////////////////////////////////////////////////////////////////////////////////////////
 
+compositing/ios [ Skip ]
 css3/touch-action [ Skip ]
 accessibility/ios-simulator [ Skip ]
 accessibility/gtk [ Skip ]

Added: trunk/LayoutTests/compositing/ios/basic-layer-properties-expected.txt (0 => 213719)


--- 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)
@@ -0,0 +1,62 @@
+Composited box.
+{
+    "anchorPoint": {
+        "x": 0.5,
+        "y": 0.5
+    },
+    "anchorPointZ": 0,
+    "bounds": {
+        "height": 148,
+        "width": 148,
+        "x": 0,
+        "y": 0
+    },
+    "contentsScale": 2,
+    "doubleSided": true,
+    "hidden": false,
+    "masksToBounds": false,
+    "opacity": 1,
+    "opaque": true,
+    "position": {
+        "x": 88,
+        "y": 80
+    },
+    "rasterizationScale": 2,
+    "sublayerTransform": {
+        "m11": 1,
+        "m12": 0,
+        "m13": 0,
+        "m14": 0,
+        "m21": 0,
+        "m22": 1,
+        "m23": 0,
+        "m24": 0,
+        "m31": 0,
+        "m32": 0,
+        "m33": 1,
+        "m34": 0,
+        "m41": 0,
+        "m42": 0,
+        "m43": 0,
+        "m44": 1
+    },
+    "transform": {
+        "m11": 1,
+        "m12": 0,
+        "m13": 0,
+        "m14": 0,
+        "m21": 0,
+        "m22": 1,
+        "m23": 0,
+        "m24": 0,
+        "m31": 0,
+        "m32": 0,
+        "m33": 1,
+        "m34": 0,
+        "m41": 0,
+        "m42": 0,
+        "m43": 0,
+        "m44": 1
+    },
+    "zPosition": 0
+}

Added: trunk/LayoutTests/compositing/ios/basic-layer-properties.html (0 => 213719)


--- 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)
@@ -0,0 +1,87 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        .box {
+            height: 100px;
+            width: 100px;
+            background-color: silver;
+            box-shadow: 0 0 10px black;
+            padding: 10px;
+            margin: 20px;
+        }
+        
+        .composited {
+            will-change: transform;
+        }
+    </style>
+    <script>
+        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' && !Array.isArray(value) && !(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);
+    </script>
+</head>
+<body>
+
+<div id="composited" class="composited box">
+    Composited box.
+</div>
+
+<pre id="layer-properties"></pre>
+</body>
+</html>

Added: trunk/LayoutTests/compositing/ios/rasterization-scale-expected.txt (0 => 213719)


--- 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)
@@ -0,0 +1,2 @@
+This text should not be blurry
+rasterizationScale of layer is 2

Added: trunk/LayoutTests/compositing/ios/rasterization-scale.html (0 => 213719)


--- 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)
@@ -0,0 +1,80 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+
+<html>
+<head>
+    <meta name="viewport" content="width=device-width">
+    <style>
+        .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;
+        }
+    </style>
+    <script>
+        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);
+    </script>
+</head>
+<body>
+
+<div class="perspective-container">
+    <div class="container">
+        <div class="middle">
+            <div id="blurry-layer">
+                This text should not be blurry
+            </div>
+        </div>
+    </div>
+</div>
+
+<pre id="layer-properties"></pre>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations (213718 => 213719)


--- 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)
@@ -6,6 +6,7 @@
 # Platform-specific directories. Skipped globally, then re-enabled here.
 #//////////////////////////////////////////////////////////////////////////////////////////
 
+compositing/ios [ Pass ]
 fast/history/ios [ Pass ]
 fast/scrolling/ios [ Pass ]
 fast/viewport/ios [ Pass ]

Modified: trunk/Source/WebCore/ChangeLog (213718 => 213719)


--- 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)
@@ -1,3 +1,37 @@
+2017-03-09  Simon Fraser  <simon.fra...@apple.com>
+
+        [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:
+
 2017-03-10  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r213618.

Modified: trunk/Source/WebCore/testing/Internals.cpp (213718 => 213719)


--- 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)
@@ -2149,6 +2149,23 @@
     return document.frame()->layerTreeAsText(toLayerTreeFlags(flags));
 }
 
+ExceptionOr<uint64_t> Internals::layerIDForElement(Element& element)
+{
+    Document* document = contextDocument();
+    if (!document || !document->frame())
+        return Exception { INVALID_ACCESS_ERR };
+
+    if (!element.renderer() || !element.renderer()->hasLayer())
+        return Exception { NOT_FOUND_ERR };
+
+    auto& layerModelObject = downcast<RenderLayerModelObject>(*element.renderer());
+    if (!layerModelObject.layer()->isComposited())
+        return Exception { NOT_FOUND_ERR };
+    
+    auto* backing = layerModelObject.layer()->backing();
+    return backing->graphicsLayer()->primaryLayerID();
+}
+
 ExceptionOr<String> Internals::repaintRectsAsText() const
 {
     Document* document = contextDocument();

Modified: trunk/Source/WebCore/testing/Internals.h (213718 => 213719)


--- 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)
@@ -274,6 +274,7 @@
         LAYER_TREE_INCLUDES_ACCELERATES_DRAWING = 32,
     };
     ExceptionOr<String> layerTreeAsText(Document&, unsigned short flags) const;
+    ExceptionOr<uint64_t> layerIDForElement(Element&);
     ExceptionOr<String> repaintRectsAsText() const;
     ExceptionOr<String> scrollingStateTreeAsText() const;
     ExceptionOr<String> mainThreadScrollingReasons() const;

Modified: trunk/Source/WebCore/testing/Internals.idl (213718 => 213719)


--- 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)
@@ -260,6 +260,8 @@
     const unsigned short LAYER_TREE_INCLUDES_ACCELERATES_DRAWING = 32;
     [MayThrowException] DOMString layerTreeAsText(Document document, optional unsigned short flags = 0);
 
+    [MayThrowException] unsigned long long layerIDForElement(Element element);
+
     [MayThrowException] DOMString scrollingStateTreeAsText();
     [MayThrowException] DOMString mainThreadScrollingReasons(); // FIXME: rename to synchronousScrollingReasons().
     [MayThrowException] ClientRectList? nonFastScrollableRects();

Modified: trunk/Source/WebKit2/ChangeLog (213718 => 213719)


--- 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)
@@ -1,3 +1,41 @@
+2017-03-09  Simon Fraser  <simon.fra...@apple.com>
+
+        [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):
+
 2017-03-10  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r213618.

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.h (213718 => 213719)


--- 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)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef RemoteLayerTreePropertyApplier_h
-#define RemoteLayerTreePropertyApplier_h
+#pragma once
 
 #include "LayerRepresentation.h"
 #include "RemoteLayerTreeTransaction.h"
@@ -44,5 +43,3 @@
 };
 
 } // namespace WebKit
-
-#endif // RemoteLayerTreePropertyApplier_h

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (213718 => 213719)


--- 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)
@@ -5154,6 +5154,83 @@
     }];
 }
 
+- (NSDictionary *)_propertiesOfLayerWithID:(unsigned long long)layerID
+{
+    CALayer* layer = asLayer(downcast<WebKit::RemoteLayerTreeDrawingAreaProxy>(*_page->drawingArea()).layerWithIDForTesting(layerID));
+    if (!layer)
+        return nil;
+
+    return @{
+        @"bounds" : @{
+            @"x" : @(layer.bounds.origin.x),
+            @"y" : @(layer.bounds.origin.x),
+            @"width" : @(layer.bounds.size.width),
+            @"height" : @(layer.bounds.size.height),
+
+        },
+        @"position" : @{
+            @"x" : @(layer.position.x),
+            @"y" : @(layer.position.y),
+        },
+        @"zPosition" : @(layer.zPosition),
+        @"anchorPoint" : @{
+            @"x" : @(layer.anchorPoint.x),
+            @"y" : @(layer.anchorPoint.y),
+        },
+        @"anchorPointZ" : @(layer.anchorPointZ),
+        @"transform" : @{
+            @"m11" : @(layer.transform.m11),
+            @"m12" : @(layer.transform.m12),
+            @"m13" : @(layer.transform.m13),
+            @"m14" : @(layer.transform.m14),
+
+            @"m21" : @(layer.transform.m21),
+            @"m22" : @(layer.transform.m22),
+            @"m23" : @(layer.transform.m23),
+            @"m24" : @(layer.transform.m24),
+
+            @"m31" : @(layer.transform.m31),
+            @"m32" : @(layer.transform.m32),
+            @"m33" : @(layer.transform.m33),
+            @"m34" : @(layer.transform.m34),
+
+            @"m41" : @(layer.transform.m41),
+            @"m42" : @(layer.transform.m42),
+            @"m43" : @(layer.transform.m43),
+            @"m44" : @(layer.transform.m44),
+        },
+        @"sublayerTransform" : @{
+            @"m11" : @(layer.sublayerTransform.m11),
+            @"m12" : @(layer.sublayerTransform.m12),
+            @"m13" : @(layer.sublayerTransform.m13),
+            @"m14" : @(layer.sublayerTransform.m14),
+
+            @"m21" : @(layer.sublayerTransform.m21),
+            @"m22" : @(layer.sublayerTransform.m22),
+            @"m23" : @(layer.sublayerTransform.m23),
+            @"m24" : @(layer.sublayerTransform.m24),
+
+            @"m31" : @(layer.sublayerTransform.m31),
+            @"m32" : @(layer.sublayerTransform.m32),
+            @"m33" : @(layer.sublayerTransform.m33),
+            @"m34" : @(layer.sublayerTransform.m34),
+
+            @"m41" : @(layer.sublayerTransform.m41),
+            @"m42" : @(layer.sublayerTransform.m42),
+            @"m43" : @(layer.sublayerTransform.m43),
+            @"m44" : @(layer.sublayerTransform.m44),
+        },
+        
+        @"hidden" : @(layer.hidden),
+        @"doubleSided" : @(layer.doubleSided),
+        @"masksToBounds" : @(layer.masksToBounds),
+        @"contentsScale" : @(layer.contentsScale),
+        @"rasterizationScale" : @(layer.rasterizationScale),
+        @"opaque" : @(layer.opaque),
+        @"opacity" : @(layer.opacity),
+    };
+}
+
 #endif // PLATFORM(IOS)
 
 #if PLATFORM(MAC)

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (213718 => 213719)


--- 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)
@@ -312,6 +312,8 @@
 
 @property (nonatomic, readonly) NSNumber *_stableStateOverride WK_API_AVAILABLE(ios(WK_IOS_TBA));
 
+- (NSDictionary *)_propertiesOfLayerWithID:(unsigned long long)layerID WK_API_AVAILABLE(ios(WK_IOS_TBA));
+
 - (void)_simulateDataInteractionEntered:(id)info WK_API_AVAILABLE(ios(WK_IOS_TBA));
 - (void)_simulateDataInteractionUpdated:(id)info WK_API_AVAILABLE(ios(WK_IOS_TBA));
 - (void)_simulateDataInteractionPerformOperation:(id)info WK_API_AVAILABLE(ios(WK_IOS_TBA));

Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h (213718 => 213719)


--- 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)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef RemoteLayerTreeDrawingAreaProxy_h
-#define RemoteLayerTreeDrawingAreaProxy_h
+#pragma once
 
 #include "DrawingAreaProxy.h"
 #include "RemoteLayerTreeHost.h"
@@ -58,6 +57,8 @@
 
     bool isAlwaysOnLoggingAllowed() const;
 
+    LayerOrView* layerWithIDForTesting(uint64_t) const;
+
 private:
     void sizeDidChange() override;
     void deviceScaleFactorDidChange() override;
@@ -119,5 +120,3 @@
 } // namespace WebKit
 
 SPECIALIZE_TYPE_TRAITS_DRAWING_AREA_PROXY(RemoteLayerTreeDrawingAreaProxy, DrawingAreaTypeRemoteLayerTree)
-
-#endif // RemoteLayerTreeDrawingAreaProxy_h

Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm (213718 => 213719)


--- 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)
@@ -478,4 +478,9 @@
     return m_webPageProxy.isAlwaysOnLoggingAllowed();
 }
 
+LayerOrView* RemoteLayerTreeDrawingAreaProxy::layerWithIDForTesting(uint64_t layerID) const
+{
+    return m_remoteLayerTreeHost.layerWithIDForTesting(layerID);
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.h (213718 => 213719)


--- 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)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef RemoteLayerTreeHost_h
-#define RemoteLayerTreeHost_h
+#pragma once
 
 #include "LayerRepresentation.h"
 #include "RemoteLayerTreeTransaction.h"
@@ -71,6 +70,8 @@
     // This avoids keeping an outstanding InUse reference when suspended.
     void mapAllIOSurfaceBackingStore();
 
+    LayerOrView* layerWithIDForTesting(uint64_t) const;
+
 private:
     LayerOrView *createLayer(const RemoteLayerTreeTransaction::LayerCreationProperties&, const RemoteLayerTreeTransaction::LayerProperties*);
     static void setLayerID(CALayer *, WebCore::GraphicsLayer::PlatformLayerID);
@@ -85,5 +86,3 @@
 };
 
 } // namespace WebKit
-
-#endif // RemoteLayerTreeHost_h

Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm (213718 => 213719)


--- 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)
@@ -204,6 +204,11 @@
     m_rootLayer = nullptr;
 }
 
+LayerOrView* RemoteLayerTreeHost::layerWithIDForTesting(uint64_t layerID) const
+{
+    return getLayer(layerID);
+}
+
 static NSString* const WKLayerIDPropertyKey = @"WKLayerID";
 
 void RemoteLayerTreeHost::setLayerID(CALayer *layer, WebCore::GraphicsLayer::PlatformLayerID layerID)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp (213718 => 213719)


--- 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)
@@ -76,8 +76,10 @@
     : PlatformCALayer(layerType, owner)
     , m_context(&context)
 {
-    if (owner)
+    if (owner) {
         m_properties.contentsScale = owner->platformCALayerDeviceScaleFactor();
+        m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ContentsScaleChanged);
+    }
 }
 
 PlatformCALayerRemote::PlatformCALayerRemote(const PlatformCALayerRemote& other, PlatformCALayerClient* owner, RemoteLayerTreeContext& context)

Modified: trunk/Tools/ChangeLog (213718 => 213719)


--- trunk/Tools/ChangeLog	2017-03-10 19:01:57 UTC (rev 213718)
+++ trunk/Tools/ChangeLog	2017-03-10 19:07:13 UTC (rev 213719)
@@ -1,3 +1,38 @@
+2017-03-09  Simon Fraser  <simon.fra...@apple.com>
+
+        [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):
+
 2017-03-10  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r213618.

Modified: trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm (213718 => 213719)


--- 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)
@@ -294,6 +294,11 @@
     return nullptr;
 }
 
+JSObjectRef UIScriptController::propertiesOfLayerWithID(uint64_t layerID) const
+{
+    return nullptr;
+}
+
 void UIScriptController::retrieveSpeakSelectionContent(JSValueRef)
 {
 }

Modified: trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl (213718 => 213719)


--- 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)
@@ -217,6 +217,8 @@
 
     readonly attribute DOMString scrollingTreeAsText;
 
+    object propertiesOfLayerWithID(unsigned long long layerID);
+
     void retrieveSpeakSelectionContent(object callback);
     readonly attribute DOMString accessibilitySpeakSelectionContent;
 

Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp (213718 => 213719)


--- 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)
@@ -340,6 +340,11 @@
     return nullptr;
 }
 
+JSObjectRef UIScriptController::propertiesOfLayerWithID(uint64_t layerID) const
+{
+    return nullptr;
+}
+
 void UIScriptController::platformSetDidStartFormControlInteractionCallback()
 {
 }

Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h (213718 => 213719)


--- 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)
@@ -140,6 +140,8 @@
     
     JSRetainPtr<JSStringRef> scrollingTreeAsText() const;
 
+    JSObjectRef propertiesOfLayerWithID(uint64_t layerID) const;
+
     void uiScriptComplete(JSStringRef result);
     
     void retrieveSpeakSelectionContent(JSValueRef);

Modified: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (213718 => 213719)


--- 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)
@@ -548,6 +548,11 @@
     return JSStringCreateWithCFString((CFStringRef)[webView _scrollingTreeAsText]);
 }
 
+JSObjectRef UIScriptController::propertiesOfLayerWithID(uint64_t layerID) const
+{
+    return JSValueToObject(m_context->jsContext(), [JSValue valueWithObject:[TestController::singleton().mainWebView()->platformView() _propertiesOfLayerWithID:layerID] inContext:[JSContext contextWithJSGlobalContextRef:m_context->jsContext()]].JSValueRef, nullptr);
+}
+
 void UIScriptController::removeViewFromWindow(JSValueRef callback)
 {
     TestController::singleton().mainWebView()->removeFromWindow();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to