Title: [265327] trunk
- Revision
- 265327
- Author
- simon.fra...@apple.com
- Date
- 2020-08-06 07:55:55 -0700 (Thu, 06 Aug 2020)
Log Message
Scrolling tree nodes sometimes don't match layer z-order
https://bugs.webkit.org/show_bug.cgi?id=215210
Reviewed by Antti Koivisto.
Source/WebCore:
When adding nodes to the scrolling state tree during compositing layer traversal,
we would sometimes add then in the wrong order. For example, if the composited layer
tree was:
+ Root
+ Stacking context
Fixed layer 1
Fixed layer 2
we would build a scrolling tree like:
+ Root scrolling node
Node for layer 2
Node for layer 1
This happened because RenderLayerCompositor::updateBackingAndHierarchy() failed to propagate up
scrollingTreeState.nextChildIndex.
This is generally benign, but inserting node 1 followed by node 2 would be seen as a scrolling tree
mutation, causing us to re-commit the scrolling tree when it hadn't really changed, triggering
extra CPU usage.
Part of <rdar://problem/62737868>: higher CPU usage on instagram.com.
Test: scrollingcoordinator/scrolling-tree/sibling-node-order.html
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
LayoutTests:
* platform/ios-wk2/scrollingcoordinator/scrolling-tree/sibling-node-order-expected.txt: Added.
* scrollingcoordinator/scrolling-tree/sibling-node-order-expected.txt: Added.
* scrollingcoordinator/scrolling-tree/sibling-node-order.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (265326 => 265327)
--- trunk/LayoutTests/ChangeLog 2020-08-06 14:48:07 UTC (rev 265326)
+++ trunk/LayoutTests/ChangeLog 2020-08-06 14:55:55 UTC (rev 265327)
@@ -1,3 +1,14 @@
+2020-08-06 Simon Fraser <simon.fra...@apple.com>
+
+ Scrolling tree nodes sometimes don't match layer z-order
+ https://bugs.webkit.org/show_bug.cgi?id=215210
+
+ Reviewed by Antti Koivisto.
+
+ * platform/ios-wk2/scrollingcoordinator/scrolling-tree/sibling-node-order-expected.txt: Added.
+ * scrollingcoordinator/scrolling-tree/sibling-node-order-expected.txt: Added.
+ * scrollingcoordinator/scrolling-tree/sibling-node-order.html: Added.
+
2020-08-06 Wenson Hsieh <wenson_hs...@apple.com>
Remove UIScriptController.removeAllDynamicDictionaries()
Added: trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/sibling-node-order-expected.txt (0 => 265327)
--- trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/sibling-node-order-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/sibling-node-order-expected.txt 2020-08-06 14:55:55 UTC (rev 265327)
@@ -0,0 +1,28 @@
+Top
+Bottom
+
+(Frame scrolling node
+ (scrollable area size 800 600)
+ (contents size 800 600)
+ (scrollable area parameters
+ (horizontal scroll elasticity 1)
+ (vertical scroll elasticity 1)
+ (horizontal scrollbar mode 0)
+ (vertical scrollbar mode 0))
+ (layout viewport at (0,0) size 800x600)
+ (min layout viewport origin (0,0))
+ (max layout viewport origin (0,0))
+ (behavior for fixed 0)
+ (children 2
+ (Fixed node
+ (anchor edges: AnchorEdgeLeft AnchorEdgeTop)
+ (viewport rect at last layout at (0,0) size 800x600)
+ )
+ (Fixed node
+ (anchor edges: AnchorEdgeLeft AnchorEdgeBottom)
+ (viewport rect at last layout at (0,0) size 800x600)
+ (layer position at last layout (0,500))
+ )
+ )
+)
+
Added: trunk/LayoutTests/scrollingcoordinator/scrolling-tree/sibling-node-order-expected.txt (0 => 265327)
--- trunk/LayoutTests/scrollingcoordinator/scrolling-tree/sibling-node-order-expected.txt (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/scrolling-tree/sibling-node-order-expected.txt 2020-08-06 14:55:55 UTC (rev 265327)
@@ -0,0 +1,28 @@
+Top
+Bottom
+
+(Frame scrolling node
+ (scrollable area size 800 600)
+ (contents size 800 600)
+ (scrollable area parameters
+ (horizontal scroll elasticity 2)
+ (vertical scroll elasticity 2)
+ (horizontal scrollbar mode 0)
+ (vertical scrollbar mode 0))
+ (layout viewport at (0,0) size 800x600)
+ (min layout viewport origin (0,0))
+ (max layout viewport origin (0,0))
+ (behavior for fixed 0)
+ (children 2
+ (Fixed node
+ (anchor edges: AnchorEdgeLeft AnchorEdgeTop)
+ (viewport rect at last layout at (0,0) size 800x600)
+ )
+ (Fixed node
+ (anchor edges: AnchorEdgeLeft AnchorEdgeBottom)
+ (viewport rect at last layout at (0,0) size 800x600)
+ (layer position at last layout (0,500))
+ )
+ )
+)
+
Added: trunk/LayoutTests/scrollingcoordinator/scrolling-tree/sibling-node-order.html (0 => 265327)
--- trunk/LayoutTests/scrollingcoordinator/scrolling-tree/sibling-node-order.html (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/scrolling-tree/sibling-node-order.html 2020-08-06 14:55:55 UTC (rev 265327)
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ .container {
+ position: relative;
+ z-index: 0;
+ width: 200px;
+ height: 200px;
+ border: 1px solid green;
+ }
+
+ .fixed {
+ position: fixed;
+ left: 0;
+ width: 100%;
+ height: 100px;
+ background-color: rgba(0, 0, 0, 0.2);
+ }
+ .top {
+ top: 0;
+ }
+ .bottom {
+ bottom: 0;
+ }
+ </style>
+ <script>
+ if (window.testRunner)
+ testRunner.dumpAsText();
+ window.addEventListener('load', () => {
+ if (window.internals)
+ document.getElementById('scrollingtree').textContent = internals.scrollingStateTreeAsText();
+
+ }, false);
+ </script>
+</head>
+<body>
+ <div class="container">
+ <div class="top fixed">
+ Top
+ </div>
+ </div>
+
+ <div class="bottom fixed">
+ Bottom
+ </div>
+<pre id="scrollingtree"></pre>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (265326 => 265327)
--- trunk/Source/WebCore/ChangeLog 2020-08-06 14:48:07 UTC (rev 265326)
+++ trunk/Source/WebCore/ChangeLog 2020-08-06 14:55:55 UTC (rev 265327)
@@ -1,3 +1,39 @@
+2020-08-06 Simon Fraser <simon.fra...@apple.com>
+
+ Scrolling tree nodes sometimes don't match layer z-order
+ https://bugs.webkit.org/show_bug.cgi?id=215210
+
+ Reviewed by Antti Koivisto.
+
+ When adding nodes to the scrolling state tree during compositing layer traversal,
+ we would sometimes add then in the wrong order. For example, if the composited layer
+ tree was:
+
+ + Root
+ + Stacking context
+ Fixed layer 1
+ Fixed layer 2
+
+ we would build a scrolling tree like:
+
+ + Root scrolling node
+ Node for layer 2
+ Node for layer 1
+
+ This happened because RenderLayerCompositor::updateBackingAndHierarchy() failed to propagate up
+ scrollingTreeState.nextChildIndex.
+
+ This is generally benign, but inserting node 1 followed by node 2 would be seen as a scrolling tree
+ mutation, causing us to re-commit the scrolling tree when it hadn't really changed, triggering
+ extra CPU usage.
+
+ Part of <rdar://problem/62737868>: higher CPU usage on instagram.com.
+
+ Test: scrollingcoordinator/scrolling-tree/sibling-node-order.html
+
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
+
2020-08-05 Rob Buis <rb...@igalia.com>
Remove the StyleResolver-specific evaluate function in MediaQueryEvaluator
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (265326 => 265327)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2020-08-06 14:48:07 UTC (rev 265326)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2020-08-06 14:55:55 UTC (rev 265327)
@@ -1356,6 +1356,9 @@
// Pass needSynchronousScrollingReasonsUpdate back up.
scrollingTreeState.needSynchronousScrollingReasonsUpdate |= scrollingStateForDescendants.needSynchronousScrollingReasonsUpdate;
+ if (scrollingTreeState.parentNodeID == scrollingStateForDescendants.parentNodeID)
+ scrollingTreeState.nextChildIndex = scrollingStateForDescendants.nextChildIndex;
+
} else if (requiresChildRebuild)
appendForegroundLayerIfNecessary();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes