Source/WebCore: REGRESSION (r155998): Elements render at very low resolution with...
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Apr 2014 01:11:52 +0000 (01:11 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Apr 2014 01:11:52 +0000 (01:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=131412
<rdar://problem/16525044>

Reviewed by Tim Horton.

In r155998 we started to compute a root-relative transform in order to choose
a good contentsScale to avoid blurring on scaling.

However, the code failed to update this transform when passing over
GraphicsLayerCAs with no uncommitted changes, which caused us to choose
an incorrect contentsScale sometimes, resulting in blurriness.

Fix by updating the root-relative transform on layers with no uncommitted
changes.

Test: compositing/contents-scale/incremental-change.html

* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):

LayoutTests: REGRESSION (r155998): Elements render at very low resolution with some 3d transforms
https://bugs.webkit.org/show_bug.cgi?id=131412

Reviewed by Tim Horton.

Test that makes an incremental change to a layer property in a tree with
interesting 3d transforms.

* compositing/contents-scale/incremental-change-expected.html: Added.
* compositing/contents-scale/incremental-change.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166990 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/compositing/contents-scale/incremental-change-expected.html [new file with mode: 0644]
LayoutTests/compositing/contents-scale/incremental-change.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

index ebecb92..0d3cc2c 100644 (file)
@@ -1,3 +1,16 @@
+2014-04-08  Simon Fraser  <simon.fraser@apple.com>
+
+        REGRESSION (r155998): Elements render at very low resolution with some 3d transforms
+        https://bugs.webkit.org/show_bug.cgi?id=131412
+
+        Reviewed by Tim Horton.
+        
+        Test that makes an incremental change to a layer property in a tree with
+        interesting 3d transforms.
+
+        * compositing/contents-scale/incremental-change-expected.html: Added.
+        * compositing/contents-scale/incremental-change.html: Added.
+
 2014-04-08  Adenilson Cavalcanti  <cavalcantii@gmail.com>
 
         [SVG] Fix CSS transform handling when zoomed
diff --git a/LayoutTests/compositing/contents-scale/incremental-change-expected.html b/LayoutTests/compositing/contents-scale/incremental-change-expected.html
new file mode 100644 (file)
index 0000000..a0b3ae7
--- /dev/null
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        * {
+            box-sizing: border-box;
+        }
+        .container {
+            width: 100px;
+            height: 100px;
+            margin: 200px;
+            -webkit-perspective: 1000px;
+            border: 1px solid black;
+        }
+        
+        .middle {
+            -webkit-transform-style: preserve-3d;
+            -webkit-transform: translate3d(0px, 0px, 800px);
+            width: 100px;
+            height: 100px;
+        }
+        
+        #leaf {
+            width: 400px;
+            height: 401px;
+            position: absolute;
+            border: 5px solid blue;
+            -webkit-transform-origin: top left;
+            -webkit-transform: matrix3d(
+                    0.2, 0, 0, 0,
+                    0, 0.2, 0, 0,
+                    0, 0, 0.2, 0,
+                    0, 0, 0, 1);
+            background-image: repeating-linear-gradient(white, black 50px, white 50px);
+        }
+    </style>
+</head>
+<body>
+    <div class="container">
+        <div class="middle">
+            <div id="leaf">
+            </div>
+        </div>
+    </div>
+</body>
+</html>
diff --git a/LayoutTests/compositing/contents-scale/incremental-change.html b/LayoutTests/compositing/contents-scale/incremental-change.html
new file mode 100644 (file)
index 0000000..fe32801
--- /dev/null
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        * {
+            box-sizing: border-box;
+        }
+        .container {
+            width: 100px;
+            height: 100px;
+            margin: 200px;
+            -webkit-perspective: 1000px;
+            border: 1px solid black;
+        }
+        
+        .middle {
+            -webkit-transform-style: preserve-3d;
+            -webkit-transform: translate3d(0px, 0px, 800px);
+            width: 100px;
+            height: 100px;
+        }
+        
+        #leaf {
+            width: 400px;
+            height: 400px;
+            position: absolute;
+            border: 5px solid blue;
+            -webkit-transform-origin: top left;
+            -webkit-transform: matrix3d(
+                    0.2, 0, 0, 0,
+                    0, 0.2, 0, 0,
+                    0, 0, 0.2, 0,
+                    0, 0, 0, 1);
+            background-image: repeating-linear-gradient(white, black 50px, white 50px);
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.waitUntilDone();
+        
+        function doTest()
+        {
+            window.setTimeout(function() {
+                window.setTimeout(function() {
+                    document.getElementById('leaf').style.height = '401px';
+                    if (window.testRunner)
+                        testRunner.notifyDone();
+                }, 0);
+            }, 0);
+        }
+        
+        window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+
+    <div class="container">
+        <div class="middle">
+            <div id="leaf">
+            </div>
+        </div>
+    </div>
+</body>
+</html>
index 8c38417..8caa107 100644 (file)
@@ -1,3 +1,26 @@
+2014-04-08  Simon Fraser  <simon.fraser@apple.com>
+
+        REGRESSION (r155998): Elements render at very low resolution with some 3d transforms
+        https://bugs.webkit.org/show_bug.cgi?id=131412
+        <rdar://problem/16525044>
+
+        Reviewed by Tim Horton.
+        
+        In r155998 we started to compute a root-relative transform in order to choose
+        a good contentsScale to avoid blurring on scaling.
+        
+        However, the code failed to update this transform when passing over
+        GraphicsLayerCAs with no uncommitted changes, which caused us to choose
+        an incorrect contentsScale sometimes, resulting in blurriness.
+        
+        Fix by updating the root-relative transform on layers with no uncommitted
+        changes.
+
+        Test: compositing/contents-scale/incremental-change.html
+
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
+
 2014-04-08  Anders Carlsson  <andersca@apple.com>
 
         Don't call CGPathAddPath with invalid CGAffineTransform objects
index 4664947..32d6ba5 100644 (file)
@@ -1336,6 +1336,8 @@ void GraphicsLayerCA::commitLayerChangesBeforeSublayers(CommitState& commitState
         // Ensure that we cap layer depth in commitLayerChangesAfterSublayers().
         if (commitState.treeDepth > cMaxLayerTreeDepth)
             m_uncommittedChanges |= ChildrenChanged;
+
+        updateRootRelativeScale(transformFromRoot);
         return;
     }