Title: [239150] trunk
Revision
239150
Author
simon.fra...@apple.com
Date
2018-12-12 20:46:25 -0800 (Wed, 12 Dec 2018)

Log Message

REGRESSION (r238090): CAPCHA UI jumps to the wrong location
https://bugs.webkit.org/show_bug.cgi?id=192651
rdar://problem/46531919

Reviewed by Zalan Bujtas.

Source/WebCore:

When a RenderLayer becomes non-composited because of a style change, we need to set a dirty
bit to say that descendants need their geometry updated (because they now have to
compute their positions relative to a different ancestor). This wasn't happening
in the layerStyleChanged() code path.

In the code path that did do this correctly (in the computeCompositingRequirements() tree walk),
we can address a FIXME and only dirty direct children, not all descendants (that code was
written before the child-only dirty bit existed).

Test: compositing/geometry/update-child-geometry-on-compositing-change.html

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::computeCompositingRequirements):
(WebCore::RenderLayerCompositor::layerStyleChanged):

LayoutTests:

Testcase that makes an intermediate layer non-composited (but still a RenderLayer).

* compositing/geometry/update-child-geometry-on-compositing-change-expected.html: Added.
* compositing/geometry/update-child-geometry-on-compositing-change.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (239149 => 239150)


--- trunk/LayoutTests/ChangeLog	2018-12-13 03:54:13 UTC (rev 239149)
+++ trunk/LayoutTests/ChangeLog	2018-12-13 04:46:25 UTC (rev 239150)
@@ -1,3 +1,16 @@
+2018-12-12  Simon Fraser  <simon.fra...@apple.com>
+
+        REGRESSION (r238090): CAPCHA UI jumps to the wrong location
+        https://bugs.webkit.org/show_bug.cgi?id=192651
+        rdar://problem/46531919
+
+        Reviewed by Zalan Bujtas.
+        
+        Testcase that makes an intermediate layer non-composited (but still a RenderLayer).
+
+        * compositing/geometry/update-child-geometry-on-compositing-change-expected.html: Added.
+        * compositing/geometry/update-child-geometry-on-compositing-change.html: Added.
+
 2018-12-12  Ryosuke Niwa  <rn...@webkit.org>
 
         Make TextInputController.legacyAttributedString take DOM nodes and offsets

Added: trunk/LayoutTests/compositing/geometry/update-child-geometry-on-compositing-change-expected.html (0 => 239150)


--- trunk/LayoutTests/compositing/geometry/update-child-geometry-on-compositing-change-expected.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/geometry/update-child-geometry-on-compositing-change-expected.html	2018-12-13 04:46:25 UTC (rev 239150)
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        .container {
+            position: relative;
+            margin: 20px;
+            width: 300px;
+            height: 300px;
+            border: 1px solid black;
+        }
+        .box {
+            position: absolute;
+            left: 50px;
+            top: 50px;
+            z-index: 0;
+            width: 200px;
+            height: 200px;
+        }
+        .middle {
+            background-color: red;
+        }
+        .child {
+            background-color: green;
+            top: 0;
+            left: 0;
+        }
+        .composited {
+            transform: translateZ(0);
+        }
+    </style>
+</head>
+<body>
+    <div class="composited container">
+        <div id="target" class="middle box">
+            <div class="child composited box"></div>
+        </div>
+    </div>
+</body>
+</html>

Added: trunk/LayoutTests/compositing/geometry/update-child-geometry-on-compositing-change.html (0 => 239150)


--- trunk/LayoutTests/compositing/geometry/update-child-geometry-on-compositing-change.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/geometry/update-child-geometry-on-compositing-change.html	2018-12-13 04:46:25 UTC (rev 239150)
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        .container {
+            position: relative;
+            margin: 20px;
+            width: 300px;
+            height: 300px;
+            border: 1px solid black;
+        }
+        .box {
+            position: absolute;
+            left: 50px;
+            top: 50px;
+            z-index: 0;
+            width: 200px;
+            height: 200px;
+        }
+        .middle {
+            background-color: red;
+        }
+        .child {
+            background-color: green;
+            top: 0;
+            left: 0;
+        }
+        .composited {
+            transform: translateZ(0);
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.waitUntilDone();
+
+        window.addEventListener('load', () => {
+            requestAnimationFrame(() => {
+                document.getElementById('target').classList.remove('composited');
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            });
+        }, false);
+    </script>
+</head>
+<body>
+    <div class="composited container">
+        <div id="target" class="middle composited box">
+            <div class="child composited box"></div>
+        </div>
+    </div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (239149 => 239150)


--- trunk/Source/WebCore/ChangeLog	2018-12-13 03:54:13 UTC (rev 239149)
+++ trunk/Source/WebCore/ChangeLog	2018-12-13 04:46:25 UTC (rev 239150)
@@ -1,3 +1,26 @@
+2018-12-12  Simon Fraser  <simon.fra...@apple.com>
+
+        REGRESSION (r238090): CAPCHA UI jumps to the wrong location
+        https://bugs.webkit.org/show_bug.cgi?id=192651
+        rdar://problem/46531919
+
+        Reviewed by Zalan Bujtas.
+        
+        When a RenderLayer becomes non-composited because of a style change, we need to set a dirty
+        bit to say that descendants need their geometry updated (because they now have to
+        compute their positions relative to a different ancestor). This wasn't happening
+        in the layerStyleChanged() code path.
+        
+        In the code path that did do this correctly (in the computeCompositingRequirements() tree walk),
+        we can address a FIXME and only dirty direct children, not all descendants (that code was
+        written before the child-only dirty bit existed).
+
+        Test: compositing/geometry/update-child-geometry-on-compositing-change.html
+
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::computeCompositingRequirements):
+        (WebCore::RenderLayerCompositor::layerStyleChanged):
+
 2018-12-13  Ryosuke Niwa  <rn...@webkit.org>
 
         Make TextInputController.legacyAttributedString take DOM nodes and offsets

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (239149 => 239150)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2018-12-13 03:54:13 UTC (rev 239149)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2018-12-13 04:46:25 UTC (rev 239150)
@@ -986,8 +986,8 @@
     // during post-order traversal (e.g. for clipping).
     if (updateBacking(layer, queryData, CompositingChangeRepaintNow, willBeComposited ? BackingRequired::Yes : BackingRequired::No)) {
         layer.setNeedsCompositingLayerConnection();
-        // Child layers need to get a geometry update to recompute their position. FIXME: Ideally we'd only dirty direct children.
-        layer.setDescendantsNeedUpdateBackingAndHierarchyTraversal();
+        // Child layers need to get a geometry update to recompute their position.
+        layer.setChildrenNeedCompositingGeometryUpdate();
         // The composited bounds of enclosing layers depends on which descendants are composited, so they need a geometry update.
         layer.setNeedsCompositingGeometryUpdateOnAncestors();
     }
@@ -1379,6 +1379,7 @@
     
     bool layerChanged = updateBacking(layer, queryData, CompositingChangeRepaintNow);
     if (layerChanged) {
+        layer.setChildrenNeedCompositingGeometryUpdate();
         layer.setNeedsCompositingLayerConnection();
         layer.setSubsequentLayersNeedCompositingRequirementsTraversal();
         // Ancestor layers that composited for indirect reasons (things listed in styleChangeMayAffectIndirectCompositingReasons()) need to get updated.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to