Title: [271508] trunk
Revision
271508
Author
[email protected]
Date
2021-01-14 21:12:47 -0800 (Thu, 14 Jan 2021)

Log Message

[Async scrolling] Slow-scrolling reasons should not propagate across frame boundaries
https://bugs.webkit.org/show_bug.cgi?id=220635

Reviewed by Tim Horton.

Source/WebCore:

We should be able to do fast scrolling of the main frame when a subframe has background-attachment:fixed
content in it, but currently we propagate the "slow scrolling reasons" up to the root of
the scrolling tree, which crosses frame boundaries.

This is a partial fix for the problem; ThreadedScrollingTree::canUpdateLayersOnScrollingThread()
is still consulting tree-wide state.

Test: scrollingcoordinator/mac/fixed-backgrounds/fixed-background-in-overflow-in-iframe.html

* page/scrolling/ScrollingStateFrameScrollingNode.cpp:
(WebCore::ScrollingStateFrameScrollingNode::dumpProperties const):
* page/scrolling/ThreadedScrollingTree.cpp:
(WebCore::ThreadedScrollingTree::propagateSynchronousScrollingReasons):
(WebCore::ThreadedScrollingTree::canUpdateLayersOnScrollingThread const):
* page/scrolling/ThreadedScrollingTree.h:

LayoutTests:

* scrollingcoordinator/mac/fixed-backgrounds/fixed-background-in-overflow-in-iframe-expected.txt: Added.
* scrollingcoordinator/mac/fixed-backgrounds/fixed-background-in-overflow-in-iframe.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (271507 => 271508)


--- trunk/LayoutTests/ChangeLog	2021-01-15 02:00:26 UTC (rev 271507)
+++ trunk/LayoutTests/ChangeLog	2021-01-15 05:12:47 UTC (rev 271508)
@@ -1,3 +1,13 @@
+2021-01-14  Simon Fraser  <[email protected]>
+
+        [Async scrolling] Slow-scrolling reasons should not propagate across frame boundaries
+        https://bugs.webkit.org/show_bug.cgi?id=220635
+
+        Reviewed by Tim Horton.
+
+        * scrollingcoordinator/mac/fixed-backgrounds/fixed-background-in-overflow-in-iframe-expected.txt: Added.
+        * scrollingcoordinator/mac/fixed-backgrounds/fixed-background-in-overflow-in-iframe.html: Added.
+
 2021-01-14  Aditya Keerthi  <[email protected]>
 
         [Cocoa] Strip DataDetectors links when copying content to the pasteboard

Added: trunk/LayoutTests/scrollingcoordinator/mac/fixed-backgrounds/fixed-background-in-overflow-in-iframe-expected.txt (0 => 271508)


--- trunk/LayoutTests/scrollingcoordinator/mac/fixed-backgrounds/fixed-background-in-overflow-in-iframe-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/mac/fixed-backgrounds/fixed-background-in-overflow-in-iframe-expected.txt	2021-01-15 05:12:47 UTC (rev 271508)
@@ -0,0 +1,45 @@
+
+
+(scrolling tree
+  (frame scrolling node
+    (scrollable area size width=785 height=600)
+    (total content size width=785 height=2016)
+    (last committed scroll position (0,0))
+    (scrollable area parameters
+      (horizontal scroll elasticity 2)
+      (vertical scroll elasticity 2)
+      (horizontal scrollbar mode 0)
+      (vertical scrollbar mode 0)
+      (allows vertical scrolling 1))
+    (layout viewport (0,0) width=785 height=600)
+    (min layoutViewport origin (0,0))
+    (max layoutViewport origin (0,1416))
+    (behavior for fixed 0)
+    (frame hosting node
+      (frame scrolling node
+        (scrollable area size width=500 height=400)
+        (total content size width=500 height=400)
+        (last committed scroll position (0,0))
+        (scrollable area parameters
+          (horizontal scroll elasticity 0)
+          (vertical scroll elasticity 0)
+          (horizontal scrollbar mode 0)
+          (vertical scrollbar mode 0))
+        (synchronous scrolling reasons Has slow repaint descendant scrollers)
+        (layout viewport (0,0) width=500 height=400)
+        (min layoutViewport origin (0,0))
+        (max layoutViewport origin (0,0))
+        (behavior for fixed 0)
+        (overflow scrolling node
+          (scrollable area size width=405 height=305)
+          (total content size width=410 height=1020)
+          (last committed scroll position (0,0))
+          (scrollable area parameters
+            (horizontal scroll elasticity 0)
+            (vertical scroll elasticity 0)
+            (horizontal scrollbar mode 0)
+            (vertical scrollbar mode 0)
+            (allows horizontal scrolling 1)
+            (allows vertical scrolling 1))
+          (synchronous scrolling reasons Has slow repaint objects))))))
+

Added: trunk/LayoutTests/scrollingcoordinator/mac/fixed-backgrounds/fixed-background-in-overflow-in-iframe.html (0 => 271508)


--- trunk/LayoutTests/scrollingcoordinator/mac/fixed-backgrounds/fixed-background-in-overflow-in-iframe.html	                        (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/mac/fixed-backgrounds/fixed-background-in-overflow-in-iframe.html	2021-01-15 05:12:47 UTC (rev 271508)
@@ -0,0 +1,60 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ AsyncOverflowScrollingEnabled=true AsyncFrameScrollingEnabled=true ] -->
+<html>
+<head>
+    <title>Slow-scrolling reasons should not escape the iframe boundary</title>
+    <style>
+        body {
+            height: 2000px;
+        }
+        iframe {
+            width: 500px;
+            height: 400px;
+            border: 1px solid black;
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.dumpAsText();
+
+        window.addEventListener('load', () => {
+            if (window.internals)
+                document.getElementById('scrollingTree').innerText = window.internals.scrollingTreeAsText() + "\n";
+        }, false);
+    </script>
+</head>
+<body>
+    <iframe srcdoc="
+        <style>
+        .scroller {
+            background-color: silver;
+            border: 1px solid black;
+            padding: 10px;
+            width: 400px;
+            height: 300px;
+            overflow: scroll;
+        }
+        
+        .scrolling-content {
+            height: 1000px;
+        }
+        
+        .fixed-background {
+            margin-top: 100px;
+            width: 400px;
+            height: 300px;
+            background-image: linear-gradient(green, blue);
+            background-attachment: fixed;
+        }
+        </style>
+        <div class=scroller>
+            <div class=scrolling-content>
+                Scrolling content
+                <div class=fixed-background>
+                    Fixed background
+                </div>
+            </div>
+        </div>
+    "></iframe>
+    <pre id="scrollingTree"></pre>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (271507 => 271508)


--- trunk/Source/WebCore/ChangeLog	2021-01-15 02:00:26 UTC (rev 271507)
+++ trunk/Source/WebCore/ChangeLog	2021-01-15 05:12:47 UTC (rev 271508)
@@ -1,3 +1,26 @@
+2021-01-14  Simon Fraser  <[email protected]>
+
+        [Async scrolling] Slow-scrolling reasons should not propagate across frame boundaries
+        https://bugs.webkit.org/show_bug.cgi?id=220635
+
+        Reviewed by Tim Horton.
+
+        We should be able to do fast scrolling of the main frame when a subframe has background-attachment:fixed
+        content in it, but currently we propagate the "slow scrolling reasons" up to the root of
+        the scrolling tree, which crosses frame boundaries.
+
+        This is a partial fix for the problem; ThreadedScrollingTree::canUpdateLayersOnScrollingThread()
+        is still consulting tree-wide state.
+
+        Test: scrollingcoordinator/mac/fixed-backgrounds/fixed-background-in-overflow-in-iframe.html
+
+        * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
+        (WebCore::ScrollingStateFrameScrollingNode::dumpProperties const):
+        * page/scrolling/ThreadedScrollingTree.cpp:
+        (WebCore::ThreadedScrollingTree::propagateSynchronousScrollingReasons):
+        (WebCore::ThreadedScrollingTree::canUpdateLayersOnScrollingThread const):
+        * page/scrolling/ThreadedScrollingTree.h:
+
 2021-01-14  Aditya Keerthi  <[email protected]>
 
         [Cocoa] Strip DataDetectors links when copying content to the pasteboard

Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateFrameScrollingNode.cpp (271507 => 271508)


--- trunk/Source/WebCore/page/scrolling/ScrollingStateFrameScrollingNode.cpp	2021-01-15 02:00:26 UTC (rev 271507)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateFrameScrollingNode.cpp	2021-01-15 05:12:47 UTC (rev 271508)
@@ -317,11 +317,16 @@
     
     if (behavior & ScrollingStateTreeAsTextBehaviorIncludeLayerIDs) {
         ts.dumpProperty("root contents layer ID", m_rootContentsLayer.layerID());
-        ts.dumpProperty("counter scrolling layer ID", m_counterScrollingLayer.layerID());
-        ts.dumpProperty("inset clip layer ID", m_insetClipLayer.layerID());
-        ts.dumpProperty("content shadow layer ID", m_contentShadowLayer.layerID());
-        ts.dumpProperty("header layer ID", m_headerLayer.layerID());
-        ts.dumpProperty("footer layer ID", m_footerLayer.layerID());
+        if (m_counterScrollingLayer.layerID())
+            ts.dumpProperty("counter scrolling layer ID", m_counterScrollingLayer.layerID());
+        if (m_insetClipLayer.layerID())
+            ts.dumpProperty("inset clip layer ID", m_insetClipLayer.layerID());
+        if (m_contentShadowLayer.layerID())
+            ts.dumpProperty("content shadow layer ID", m_contentShadowLayer.layerID());
+        if (m_headerLayer.layerID())
+            ts.dumpProperty("header layer ID", m_headerLayer.layerID());
+        if (m_footerLayer.layerID())
+            ts.dumpProperty("footer layer ID", m_footerLayer.layerID());
     }
 
     if (m_frameScaleFactor != 1)

Modified: trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp (271507 => 271508)


--- trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp	2021-01-15 02:00:26 UTC (rev 271507)
+++ trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp	2021-01-15 05:12:47 UTC (rev 271508)
@@ -168,11 +168,16 @@
                 currNode = nodeForID(downcast<ScrollingTreeOverflowScrollProxyNode>(*currNode).overflowScrollingNodeID());
                 continue;
             }
+            
+            if (is<ScrollingTreeFrameScrollingNode>(currNode))
+                break;
 
             currNode = currNode->parent();
         }
     };
 
+    m_hasNodesWithSynchronousScrollingReasons = !synchronousScrollingNodes.isEmpty();
+
     for (auto nodeID : synchronousScrollingNodes) {
         if (auto node = nodeForID(nodeID))
             propagateStateToAncestors(*node);
@@ -181,8 +186,7 @@
 
 bool ThreadedScrollingTree::canUpdateLayersOnScrollingThread() const
 {
-    auto* rootNode = this->rootNode();
-    return !(rootNode && rootNode->hasSynchronousScrollingReasons());
+    return m_hasNodesWithSynchronousScrollingReasons;
 }
 
 void ThreadedScrollingTree::scrollingTreeNodeDidScroll(ScrollingTreeScrollingNode& node, ScrollingLayerPositionAction scrollingLayerPositionAction)

Modified: trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h (271507 => 271508)


--- trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h	2021-01-15 02:00:26 UTC (rev 271507)
+++ trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h	2021-01-15 05:12:47 UTC (rev 271508)
@@ -113,6 +113,7 @@
     std::unique_ptr<RunLoop::Timer<ThreadedScrollingTree>> m_delayedRenderingUpdateDetectionTimer;
 
     bool m_scrollAnimatorEnabled { false };
+    bool m_hasNodesWithSynchronousScrollingReasons { false };
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to