Share more code for updating the state of frame scrolling nodes
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Mar 2019 00:36:57 +0000 (00:36 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Mar 2019 00:36:57 +0000 (00:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=195254

Reviewed by Antti Koivisto.
Source/WebCore:

Responsibility for updating state on ScrollingStateFrameScrolling nodes was split between
AsyncScrollingCoordinator::frameViewLayoutUpdated(), which is called post-layout, and
RenderLayerCompositor. This patch gives that responsibility entirely to RenderLayerCompositor,
ensuring that we update frame scrolling nodes at the same time as the rest of the scrolling
state tree.

We also share code between updating ScrollingStateFrameScrollingNodes and
ScrollingStateOverflowScrollingNodews, since both can be updated from a ScrollableArea.
Some minor cleanup of ScrollableArea is doing to help. For the first time, we're pushing
ScrollableAreaParameters for overflow scrolling nodes, allowing rubber-banding to work
on macOS.

* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
(WebCore::AsyncScrollingCoordinator::setRectRelativeToParentNode):
(WebCore::AsyncScrollingCoordinator::setFrameScrollingNodeState):
(WebCore::AsyncScrollingCoordinator::setScrollingNodeScrollableAreaGeometry):
(WebCore::AsyncScrollingCoordinator::setViewportConstraintedNodeConstraints):
(WebCore::AsyncScrollingCoordinator::setScrollingNodeGeometry): Deleted.
(WebCore::AsyncScrollingCoordinator::setViewportConstraintedNodeGeometry): Deleted.
* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::setRectRelativeToParentNode):
(WebCore::ScrollingCoordinator::setScrollingNodeScrollableAreaGeometry):
(WebCore::ScrollingCoordinator::setFrameScrollingNodeState):
(WebCore::ScrollingCoordinator::setViewportConstraintedNodeConstraints):
(WebCore::ScrollingCoordinator::setScrollingNodeGeometry): Deleted.
(WebCore::ScrollingCoordinator::setViewportConstraintedNodeGeometry): Deleted.
* platform/ScrollView.h:
(WebCore::ScrollView::horizontalScrollbarMode const): Deleted.
(WebCore::ScrollView::verticalScrollbarMode const): Deleted.
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::reachableTotalContentsSize const):
* platform/ScrollableArea.h:
(WebCore::ScrollableArea::horizontalScrollbarMode const):
(WebCore::ScrollableArea::verticalScrollbarMode const):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::overhangAmount const):
(WebCore::RenderLayer::reachableTotalContentsSize const):
(WebCore::RenderLayer::scrollableContentsSize const): Deleted.
* rendering/RenderLayer.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateCompositingLayers):
(WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
(WebCore::RenderLayerCompositor::updateScrollingNodeForViewportConstrainedRole):
(WebCore::RenderLayerCompositor::rootParentRelativeScrollableRect const):
(WebCore::RenderLayerCompositor::parentRelativeScrollableRect const):
(WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
(WebCore::RenderLayerCompositor::updateScrollingNodeForFrameHostingRole):
(WebCore::RenderLayerCompositor::computeFrameScrollingGeometry const): Deleted.
(WebCore::RenderLayerCompositor::computeFrameHostingGeometry const): Deleted.
(WebCore::RenderLayerCompositor::computeOverflowScrollingGeometry const): Deleted.
* rendering/RenderLayerCompositor.h:

LayoutTests:

New baselines. Overflow nodes get some state from ScrollableAreaParameters now, and
frame nodes get the current scroll position (which is good, since they already have
the new layout viewport).

* fast/scrolling/ios/change-scrollability-on-content-resize-expected.txt:
* fast/scrolling/ios/change-scrollability-on-content-resize-nested-expected.txt:
* platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-expected.txt:
* platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-gain-scrolling-ancestor-expected.txt:
* platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-in-fixed-expected.txt:
* platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-lose-scrolling-ancestor-expected.txt:
* platform/ios-wk2/scrollingcoordinator/scrolling-tree/gain-scrolling-node-parent-expected.txt:
* platform/ios-wk2/scrollingcoordinator/scrolling-tree/lose-scrolling-node-parent-expected.txt:
* platform/ios-wk2/scrollingcoordinator/scrolling-tree/overflow-in-fixed-expected.txt:
* platform/ios-wk2/scrollingcoordinator/scrolling-tree/remove-scrolling-role-expected.txt:
* platform/ios-wk2/scrollingcoordinator/scrolling-tree/reparent-across-compositing-layers-expected.txt:
* platform/ios-wk2/scrollingcoordinator/scrolling-tree/reparent-with-layer-removal-expected.txt:
* scrollingcoordinator/scrolling-tree/gain-scrolling-node-parent-expected.txt:
* scrollingcoordinator/scrolling-tree/lose-scrolling-node-parent-expected.txt:
* scrollingcoordinator/scrolling-tree/overflow-in-fixed-expected.txt:
* scrollingcoordinator/scrolling-tree/remove-scrolling-role-expected.txt:
* scrollingcoordinator/scrolling-tree/reparent-across-compositing-layers-expected.txt:
* scrollingcoordinator/scrolling-tree/reparent-with-layer-removal-expected.txt:
* tiled-drawing/scrolling/clamp-out-of-bounds-scrolls-expected.txt:
* tiled-drawing/scrolling/fixed/absolute-inside-fixed-expected.txt:
* tiled-drawing/scrolling/fixed/absolute-inside-out-of-view-fixed-expected.txt:
* tiled-drawing/scrolling/fixed/fixed-in-overflow-expected.txt:
* tiled-drawing/scrolling/fixed/four-bars-expected.txt:
* tiled-drawing/scrolling/fixed/four-bars-with-header-and-footer-expected.txt:
* tiled-drawing/scrolling/fixed/four-bars.html:
* tiled-drawing/scrolling/fixed/nested-fixed-expected.txt:
* tiled-drawing/scrolling/fixed/percentage-inside-fixed-expected.txt:
* tiled-drawing/scrolling/sticky/sticky-horizontal-expected.txt:
* tiled-drawing/scrolling/sticky/sticky-vertical-expected.txt:

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

45 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/scrolling/ios/change-scrollability-on-content-resize-expected.txt
LayoutTests/fast/scrolling/ios/change-scrollability-on-content-resize-nested-expected.txt
LayoutTests/fast/visual-viewport/tiled-drawing/zoomed-fixed-scrolled-down-expected.txt
LayoutTests/fast/visual-viewport/tiled-drawing/zoomed-fixed-scrolled-down-then-up-expected.txt
LayoutTests/platform/ios-wk2/TestExpectations
LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-expected.txt
LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-gain-scrolling-ancestor-expected.txt
LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-in-fixed-expected.txt
LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-lose-scrolling-ancestor-expected.txt
LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/fixed-inside-frame-expected.txt
LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/gain-scrolling-node-parent-expected.txt
LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/lose-scrolling-node-parent-expected.txt
LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/overflow-in-fixed-expected.txt
LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/remove-scrolling-role-expected.txt
LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/reparent-across-compositing-layers-expected.txt
LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/reparent-with-layer-removal-expected.txt
LayoutTests/scrollingcoordinator/scrolling-tree/gain-scrolling-node-parent-expected.txt
LayoutTests/scrollingcoordinator/scrolling-tree/lose-scrolling-node-parent-expected.txt
LayoutTests/scrollingcoordinator/scrolling-tree/overflow-in-fixed-expected.txt
LayoutTests/scrollingcoordinator/scrolling-tree/remove-scrolling-role-expected.txt
LayoutTests/scrollingcoordinator/scrolling-tree/reparent-across-compositing-layers-expected.txt
LayoutTests/scrollingcoordinator/scrolling-tree/reparent-with-layer-removal-expected.txt
LayoutTests/tiled-drawing/scrolling/clamp-out-of-bounds-scrolls-expected.txt
LayoutTests/tiled-drawing/scrolling/fixed/absolute-inside-fixed-expected.txt
LayoutTests/tiled-drawing/scrolling/fixed/absolute-inside-out-of-view-fixed-expected.txt
LayoutTests/tiled-drawing/scrolling/fixed/fixed-in-overflow-expected.txt
LayoutTests/tiled-drawing/scrolling/fixed/four-bars-expected.txt
LayoutTests/tiled-drawing/scrolling/fixed/four-bars-with-header-and-footer-expected.txt
LayoutTests/tiled-drawing/scrolling/fixed/four-bars.html
LayoutTests/tiled-drawing/scrolling/fixed/nested-fixed-expected.txt
LayoutTests/tiled-drawing/scrolling/fixed/percentage-inside-fixed-expected.txt
LayoutTests/tiled-drawing/scrolling/sticky/sticky-horizontal-expected.txt
LayoutTests/tiled-drawing/scrolling/sticky/sticky-vertical-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp
Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h
Source/WebCore/page/scrolling/ScrollingCoordinator.h
Source/WebCore/platform/ScrollView.h
Source/WebCore/platform/ScrollableArea.cpp
Source/WebCore/platform/ScrollableArea.h
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayer.h
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebCore/rendering/RenderLayerCompositor.h

index 40442d6..d0e9eb3 100644 (file)
@@ -1,3 +1,44 @@
+2019-03-02  Simon Fraser  <simon.fraser@apple.com>
+
+        Share more code for updating the state of frame scrolling nodes
+        https://bugs.webkit.org/show_bug.cgi?id=195254
+
+        Reviewed by Antti Koivisto.
+        
+        New baselines. Overflow nodes get some state from ScrollableAreaParameters now, and
+        frame nodes get the current scroll position (which is good, since they already have
+        the new layout viewport).
+
+        * fast/scrolling/ios/change-scrollability-on-content-resize-expected.txt:
+        * fast/scrolling/ios/change-scrollability-on-content-resize-nested-expected.txt:
+        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-expected.txt:
+        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-gain-scrolling-ancestor-expected.txt:
+        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-in-fixed-expected.txt:
+        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-lose-scrolling-ancestor-expected.txt:
+        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/gain-scrolling-node-parent-expected.txt:
+        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/lose-scrolling-node-parent-expected.txt:
+        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/overflow-in-fixed-expected.txt:
+        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/remove-scrolling-role-expected.txt:
+        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/reparent-across-compositing-layers-expected.txt:
+        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/reparent-with-layer-removal-expected.txt:
+        * scrollingcoordinator/scrolling-tree/gain-scrolling-node-parent-expected.txt:
+        * scrollingcoordinator/scrolling-tree/lose-scrolling-node-parent-expected.txt:
+        * scrollingcoordinator/scrolling-tree/overflow-in-fixed-expected.txt:
+        * scrollingcoordinator/scrolling-tree/remove-scrolling-role-expected.txt:
+        * scrollingcoordinator/scrolling-tree/reparent-across-compositing-layers-expected.txt:
+        * scrollingcoordinator/scrolling-tree/reparent-with-layer-removal-expected.txt:
+        * tiled-drawing/scrolling/clamp-out-of-bounds-scrolls-expected.txt:
+        * tiled-drawing/scrolling/fixed/absolute-inside-fixed-expected.txt:
+        * tiled-drawing/scrolling/fixed/absolute-inside-out-of-view-fixed-expected.txt:
+        * tiled-drawing/scrolling/fixed/fixed-in-overflow-expected.txt:
+        * tiled-drawing/scrolling/fixed/four-bars-expected.txt:
+        * tiled-drawing/scrolling/fixed/four-bars-with-header-and-footer-expected.txt:
+        * tiled-drawing/scrolling/fixed/four-bars.html:
+        * tiled-drawing/scrolling/fixed/nested-fixed-expected.txt:
+        * tiled-drawing/scrolling/fixed/percentage-inside-fixed-expected.txt:
+        * tiled-drawing/scrolling/sticky/sticky-horizontal-expected.txt:
+        * tiled-drawing/scrolling/sticky/sticky-vertical-expected.txt:
+
 2019-03-03  Diego Pino Garcia  <dpino@igalia.com>
 
         [GTK] Unreviewed test gardening
index aa1858a..24839e0 100644 (file)
         (horizontal scroll elasticity 1)
         (vertical scroll elasticity 1)
         (horizontal scrollbar mode 0)
-        (vertical scrollbar mode 0))
+        (vertical scrollbar mode 0)
+        (has enabled vertical scrollbar 1))
     )
     (Overflow scrolling node
       (scrollable area size 200 200)
         (horizontal scroll elasticity 1)
         (vertical scroll elasticity 1)
         (horizontal scrollbar mode 0)
-        (vertical scrollbar mode 0))
+        (vertical scrollbar mode 0)
+        (has enabled vertical scrollbar 1))
     )
   )
 )
index 05bd15b..7c492fd 100644 (file)
@@ -86,7 +86,8 @@
         (horizontal scroll elasticity 1)
         (vertical scroll elasticity 1)
         (horizontal scrollbar mode 0)
-        (vertical scrollbar mode 0))
+        (vertical scrollbar mode 0)
+        (has enabled vertical scrollbar 1))
     )
   )
 )
index e5187fd..69c8384 100644 (file)
@@ -1309,4 +1309,4 @@ webkit.org/b/190888 [ Release ] fast/animation/request-animation-frame.html [ Pa
 
 webkit.org/b/194826 [ Debug ] http/tests/resourceLoadStatistics/do-not-block-top-level-navigation-redirect.html [ Pass Timeout ]
 
-webkit.org/b/194253 [ Debug ] scrollingcoordinator/scrolling-tree/fixed-inside-frame.html [ Pass Failure ]
\ No newline at end of file
+webkit.org/b/194253 [ Debug ] scrollingcoordinator/scrolling-tree/fixed-inside-frame.html [ Pass Failure ]
index 5339eb2..0783b52 100644 (file)
@@ -38,7 +38,8 @@
                 (horizontal scroll elasticity 1)
                 (vertical scroll elasticity 1)
                 (horizontal scrollbar mode 0)
-                (vertical scrollbar mode 0))
+                (vertical scrollbar mode 0)
+                (has enabled vertical scrollbar 1))
               (children 1
                 (Sticky node
                   (anchor edges: AnchorEdgeTop AnchorEdgeBottom)
index d40172f..8bee0a3 100644 (file)
@@ -43,7 +43,8 @@
                     (horizontal scroll elasticity 1)
                     (vertical scroll elasticity 1)
                     (horizontal scrollbar mode 0)
-                    (vertical scrollbar mode 0))
+                    (vertical scrollbar mode 0)
+                    (has enabled vertical scrollbar 1))
                   (children 1
                     (Sticky node
                       (anchor edges: AnchorEdgeTop AnchorEdgeBottom)
index 4cd5d2b..b1478e6 100644 (file)
@@ -43,7 +43,8 @@
                     (horizontal scroll elasticity 1)
                     (vertical scroll elasticity 1)
                     (horizontal scrollbar mode 0)
-                    (vertical scrollbar mode 0))
+                    (vertical scrollbar mode 0)
+                    (has enabled vertical scrollbar 1))
                   (children 1
                     (Sticky node
                       (anchor edges: AnchorEdgeTop AnchorEdgeBottom)
index 14620b7..d07f4ce 100644 (file)
@@ -38,7 +38,8 @@
                 (horizontal scroll elasticity 1)
                 (vertical scroll elasticity 1)
                 (horizontal scrollbar mode 0)
-                (vertical scrollbar mode 0))
+                (vertical scrollbar mode 0)
+                (has enabled vertical scrollbar 1))
               (children 1
                 (Sticky node
                   (anchor edges: AnchorEdgeTop AnchorEdgeBottom)
index 1e6ed8b..e66d95f 100644 (file)
@@ -18,6 +18,7 @@
       (parent relative scrollable rect at (110,110) size 480x400)
       (children 1
         (Frame scrolling node
+          (scroll position 0 120)
           (scrollable area size 480 400)
           (contents size 480 1016)
           (requested scroll position 0 120)
index 2f15ddc..00f2369 100644 (file)
@@ -24,7 +24,9 @@ Inner scrolling content
         (horizontal scroll elasticity 1)
         (vertical scroll elasticity 1)
         (horizontal scrollbar mode 0)
-        (vertical scrollbar mode 0))
+        (vertical scrollbar mode 0)
+        (has enabled horizontal scrollbar 1)
+        (has enabled vertical scrollbar 1))
       (children 1
         (Overflow scrolling node
           (scrollable area size 420 320)
@@ -34,7 +36,8 @@ Inner scrolling content
             (horizontal scroll elasticity 1)
             (vertical scroll elasticity 1)
             (horizontal scrollbar mode 0)
-            (vertical scrollbar mode 0))
+            (vertical scrollbar mode 0)
+            (has enabled vertical scrollbar 1))
         )
       )
     )
index 2f15ddc..00f2369 100644 (file)
@@ -24,7 +24,9 @@ Inner scrolling content
         (horizontal scroll elasticity 1)
         (vertical scroll elasticity 1)
         (horizontal scrollbar mode 0)
-        (vertical scrollbar mode 0))
+        (vertical scrollbar mode 0)
+        (has enabled horizontal scrollbar 1)
+        (has enabled vertical scrollbar 1))
       (children 1
         (Overflow scrolling node
           (scrollable area size 420 320)
@@ -34,7 +36,8 @@ Inner scrolling content
             (horizontal scroll elasticity 1)
             (vertical scroll elasticity 1)
             (horizontal scrollbar mode 0)
-            (vertical scrollbar mode 0))
+            (vertical scrollbar mode 0)
+            (has enabled vertical scrollbar 1))
         )
       )
     )
index 79ad9c6..d671abd 100644 (file)
@@ -27,7 +27,8 @@ Scrolling content
             (horizontal scroll elasticity 1)
             (vertical scroll elasticity 1)
             (horizontal scrollbar mode 0)
-            (vertical scrollbar mode 0))
+            (vertical scrollbar mode 0)
+            (has enabled vertical scrollbar 1))
         )
       )
     )
index 72250e9..66d94eb 100644 (file)
@@ -21,7 +21,8 @@
         (horizontal scroll elasticity 1)
         (vertical scroll elasticity 1)
         (horizontal scrollbar mode 0)
-        (vertical scrollbar mode 0))
+        (vertical scrollbar mode 0)
+        (has enabled vertical scrollbar 1))
     )
   )
 )
index 17bb70d..fec8b0b 100644 (file)
@@ -24,7 +24,8 @@ Inner scrolling content
         (horizontal scroll elasticity 1)
         (vertical scroll elasticity 1)
         (horizontal scrollbar mode 0)
-        (vertical scrollbar mode 0))
+        (vertical scrollbar mode 0)
+        (has enabled vertical scrollbar 1))
     )
   )
 )
index da3973e..3faf1fa 100644 (file)
@@ -24,7 +24,8 @@ Inner scrolling content
         (horizontal scroll elasticity 1)
         (vertical scroll elasticity 1)
         (horizontal scrollbar mode 0)
-        (vertical scrollbar mode 0))
+        (vertical scrollbar mode 0)
+        (has enabled vertical scrollbar 1))
     )
   )
 )
index 3ca6a74..c50a5c9 100644 (file)
@@ -21,20 +21,23 @@ Inner scrolling content
       (contents size 443 1039)
       (parent relative scrollable rect at (9,9) size 405x305)
       (scrollable area parameters 
-        (horizontal scroll elasticity 1)
-        (vertical scroll elasticity 1)
+        (horizontal scroll elasticity 0)
+        (vertical scroll elasticity 0)
         (horizontal scrollbar mode 0)
-        (vertical scrollbar mode 0))
+        (vertical scrollbar mode 0)
+        (has enabled horizontal scrollbar 1)
+        (has enabled vertical scrollbar 1))
       (children 1
         (Overflow scrolling node
           (scrollable area size 405 305)
           (contents size 405 1020)
           (parent relative scrollable rect at (23,59) size 405x305)
           (scrollable area parameters 
-            (horizontal scroll elasticity 1)
-            (vertical scroll elasticity 1)
+            (horizontal scroll elasticity 0)
+            (vertical scroll elasticity 0)
             (horizontal scrollbar mode 0)
-            (vertical scrollbar mode 0))
+            (vertical scrollbar mode 0)
+            (has enabled vertical scrollbar 1))
         )
       )
     )
index 3ca6a74..c50a5c9 100644 (file)
@@ -21,20 +21,23 @@ Inner scrolling content
       (contents size 443 1039)
       (parent relative scrollable rect at (9,9) size 405x305)
       (scrollable area parameters 
-        (horizontal scroll elasticity 1)
-        (vertical scroll elasticity 1)
+        (horizontal scroll elasticity 0)
+        (vertical scroll elasticity 0)
         (horizontal scrollbar mode 0)
-        (vertical scrollbar mode 0))
+        (vertical scrollbar mode 0)
+        (has enabled horizontal scrollbar 1)
+        (has enabled vertical scrollbar 1))
       (children 1
         (Overflow scrolling node
           (scrollable area size 405 305)
           (contents size 405 1020)
           (parent relative scrollable rect at (23,59) size 405x305)
           (scrollable area parameters 
-            (horizontal scroll elasticity 1)
-            (vertical scroll elasticity 1)
+            (horizontal scroll elasticity 0)
+            (vertical scroll elasticity 0)
             (horizontal scrollbar mode 0)
-            (vertical scrollbar mode 0))
+            (vertical scrollbar mode 0)
+            (has enabled vertical scrollbar 1))
         )
       )
     )
index 15f9b99..a21ec79 100644 (file)
@@ -24,10 +24,11 @@ Scrolling content
           (contents size 385 1000)
           (parent relative scrollable rect at (0,0) size 385x285)
           (scrollable area parameters 
-            (horizontal scroll elasticity 1)
-            (vertical scroll elasticity 1)
+            (horizontal scroll elasticity 0)
+            (vertical scroll elasticity 0)
             (horizontal scrollbar mode 0)
-            (vertical scrollbar mode 0))
+            (vertical scrollbar mode 0)
+            (has enabled vertical scrollbar 1))
         )
       )
     )
index 2b07022..409b641 100644 (file)
       (parent relative scrollable rect at (14,14) size 285x400)
       (scrollable area parameters 
         (horizontal scroll elasticity 1)
-        (vertical scroll elasticity 1)
+        (vertical scroll elasticity 0)
         (horizontal scrollbar mode 0)
-        (vertical scrollbar mode 0))
+        (vertical scrollbar mode 0)
+        (has enabled vertical scrollbar 1))
     )
   )
 )
index d96c3d2..11201a7 100644 (file)
@@ -21,10 +21,11 @@ Inner scrolling content
       (contents size 425 1040)
       (parent relative scrollable rect at (70,98) size 425x325)
       (scrollable area parameters 
-        (horizontal scroll elasticity 1)
-        (vertical scroll elasticity 1)
+        (horizontal scroll elasticity 0)
+        (vertical scroll elasticity 0)
         (horizontal scrollbar mode 0)
-        (vertical scrollbar mode 0))
+        (vertical scrollbar mode 0)
+        (has enabled vertical scrollbar 1))
     )
   )
 )
index 2babd2c..c1e5269 100644 (file)
@@ -22,10 +22,11 @@ Inner scrolling content
       (contents size 425 1040)
       (parent relative scrollable rect at (70,98) size 425x325)
       (scrollable area parameters 
-        (horizontal scroll elasticity 1)
-        (vertical scroll elasticity 1)
+        (horizontal scroll elasticity 0)
+        (vertical scroll elasticity 0)
         (horizontal scrollbar mode 0)
-        (vertical scrollbar mode 0))
+        (vertical scrollbar mode 0)
+        (has enabled vertical scrollbar 1))
     )
   )
 )
index 7220573..165f444 100644 (file)
@@ -79,6 +79,7 @@ Attempted scroll to 10000, 0
 Attempted scroll to 0, 10000
 
 (Frame scrolling node
+  (scroll position 4223 0)
   (scrollable area size 785 585)
   (contents size 5008 5021)
   (requested scroll position 0 4436)
@@ -100,6 +101,7 @@ Attempted scroll to 0, 10000
 Attempted scroll to 10000, 10000
 
 (Frame scrolling node
+  (scroll position 0 4436)
   (scrollable area size 785 585)
   (contents size 5008 5021)
   (requested scroll position 4223 4436)
index 706270d..2331bbc 100644 (file)
@@ -1,5 +1,6 @@
 
 (Frame scrolling node
+  (scroll position 0 200)
   (scrollable area size 785 600)
   (contents size 785 2710)
   (requested scroll position 0 200)
index 41c9bbd..4d819ac 100644 (file)
@@ -1,5 +1,6 @@
 
 (Frame scrolling node
+  (scroll position 0 200)
   (scrollable area size 785 600)
   (contents size 785 2213)
   (requested scroll position 0 200)
index b5e4e49..ab63b8e 100644 (file)
@@ -1,5 +1,6 @@
 
 (Frame scrolling node
+  (scroll position 0 200)
   (scrollable area size 785 600)
   (contents size 785 2221)
   (requested scroll position 0 200)
index ed04ca7..ca6dcfd 100644 (file)
@@ -2,8 +2,7 @@
 
 <html>
 <head>
-    <meta name="apple-mobile-web-app-capable" content="yes">
-    <style type="text/css" media="screen">
+    <style>
       body {
         height: 2200px;
       }
@@ -16,7 +15,7 @@
         height: 50px;
         background-color: rgba(0, 128, 0, 0.8);
         border: 2px solid black;
-        -webkit-box-shadow: 0 0 10px black;
+        box-shadow: 0 0 10px black;
       }
       
       .top, .bottom {
@@ -44,7 +43,7 @@
       }
       
     </style>
-    <script type="text/javascript" charset="utf-8">
+    <script>
       if (window.testRunner) {
         testRunner.waitUntilDone();
         testRunner.dumpAsText();
index de62597..9d8d279 100644 (file)
@@ -1,5 +1,6 @@
 
 (Frame scrolling node
+  (scroll position 0 200)
   (scrollable area size 785 600)
   (contents size 785 2213)
   (requested scroll position 0 200)
index 53a3a91..64d4025 100644 (file)
@@ -1,5 +1,6 @@
 
 (Frame scrolling node
+  (scroll position 0 200)
   (scrollable area size 785 600)
   (contents size 785 2513)
   (requested scroll position 0 200)
index def9c96..cfe036b 100644 (file)
@@ -1,6 +1,7 @@
 Left sticky Right sticky Left % sticky Right % sticky Left and Right Left and Right %
 
 (Frame scrolling node
+  (scroll position 800 0)
   (scrollable area size 800 585)
   (contents size 2008 585)
   (requested scroll position 800 0)
index f5ae384..34a7e5a 100644 (file)
@@ -5,6 +5,7 @@ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
 
 
 (Frame scrolling node
+  (scroll position 0 580)
   (scrollable area size 785 600)
   (contents size 785 2908)
   (requested scroll position 0 580)
index a73a8a5..4b450d2 100644 (file)
@@ -1,3 +1,64 @@
+2019-03-02  Simon Fraser  <simon.fraser@apple.com>
+
+        Share more code for updating the state of frame scrolling nodes
+        https://bugs.webkit.org/show_bug.cgi?id=195254
+
+        Reviewed by Antti Koivisto.
+
+        Responsibility for updating state on ScrollingStateFrameScrolling nodes was split between
+        AsyncScrollingCoordinator::frameViewLayoutUpdated(), which is called post-layout, and
+        RenderLayerCompositor. This patch gives that responsibility entirely to RenderLayerCompositor,
+        ensuring that we update frame scrolling nodes at the same time as the rest of the scrolling
+        state tree.
+        
+        We also share code between updating ScrollingStateFrameScrollingNodes and
+        ScrollingStateOverflowScrollingNodews, since both can be updated from a ScrollableArea.
+        Some minor cleanup of ScrollableArea is doing to help. For the first time, we're pushing
+        ScrollableAreaParameters for overflow scrolling nodes, allowing rubber-banding to work
+        on macOS.
+
+        * page/scrolling/AsyncScrollingCoordinator.cpp:
+        (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
+        (WebCore::AsyncScrollingCoordinator::setRectRelativeToParentNode):
+        (WebCore::AsyncScrollingCoordinator::setFrameScrollingNodeState):
+        (WebCore::AsyncScrollingCoordinator::setScrollingNodeScrollableAreaGeometry):
+        (WebCore::AsyncScrollingCoordinator::setViewportConstraintedNodeConstraints):
+        (WebCore::AsyncScrollingCoordinator::setScrollingNodeGeometry): Deleted.
+        (WebCore::AsyncScrollingCoordinator::setViewportConstraintedNodeGeometry): Deleted.
+        * page/scrolling/AsyncScrollingCoordinator.h:
+        * page/scrolling/ScrollingCoordinator.h:
+        (WebCore::ScrollingCoordinator::setRectRelativeToParentNode):
+        (WebCore::ScrollingCoordinator::setScrollingNodeScrollableAreaGeometry):
+        (WebCore::ScrollingCoordinator::setFrameScrollingNodeState):
+        (WebCore::ScrollingCoordinator::setViewportConstraintedNodeConstraints):
+        (WebCore::ScrollingCoordinator::setScrollingNodeGeometry): Deleted.
+        (WebCore::ScrollingCoordinator::setViewportConstraintedNodeGeometry): Deleted.
+        * platform/ScrollView.h:
+        (WebCore::ScrollView::horizontalScrollbarMode const): Deleted.
+        (WebCore::ScrollView::verticalScrollbarMode const): Deleted.
+        * platform/ScrollableArea.cpp:
+        (WebCore::ScrollableArea::reachableTotalContentsSize const):
+        * platform/ScrollableArea.h:
+        (WebCore::ScrollableArea::horizontalScrollbarMode const):
+        (WebCore::ScrollableArea::verticalScrollbarMode const):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::overhangAmount const):
+        (WebCore::RenderLayer::reachableTotalContentsSize const):
+        (WebCore::RenderLayer::scrollableContentsSize const): Deleted.
+        * rendering/RenderLayer.h:
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::updateCompositingLayers):
+        (WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
+        (WebCore::RenderLayerCompositor::updateScrollingNodeForViewportConstrainedRole):
+        (WebCore::RenderLayerCompositor::rootParentRelativeScrollableRect const):
+        (WebCore::RenderLayerCompositor::parentRelativeScrollableRect const):
+        (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
+        (WebCore::RenderLayerCompositor::updateScrollingNodeForFrameHostingRole):
+        (WebCore::RenderLayerCompositor::computeFrameScrollingGeometry const): Deleted.
+        (WebCore::RenderLayerCompositor::computeFrameHostingGeometry const): Deleted.
+        (WebCore::RenderLayerCompositor::computeOverflowScrollingGeometry const): Deleted.
+        * rendering/RenderLayerCompositor.h:
+
 2019-03-02  Darin Adler  <darin@apple.com>
 
         Retire legacy dtoa function and DecimalNumber class
index 0585ab6..19771e7 100644 (file)
@@ -127,60 +127,23 @@ void AsyncScrollingCoordinator::frameViewLayoutUpdated(FrameView& frameView)
         return;
 
     setEventTrackingRegionsDirty();
-    if (!coordinatesScrollingForFrameView(frameView))
-        return;
 
-    auto* node = m_scrollingStateTree->stateNodeForID(frameView.scrollingNodeID());
-    if (!node || !is<ScrollingStateFrameScrollingNode>(*node))
+#if PLATFORM(COCOA)
+    if (!coordinatesScrollingForFrameView(frameView))
         return;
 
-    auto& frameScrollingNode = downcast<ScrollingStateFrameScrollingNode>(*node);
-
-    auto* verticalScrollbar = frameView.verticalScrollbar();
-    auto* horizontalScrollbar = frameView.horizontalScrollbar();
-    frameScrollingNode.setScrollerImpsFromScrollbars(verticalScrollbar, horizontalScrollbar);
-
-    frameScrollingNode.setFrameScaleFactor(frameView.frame().frameScaleFactor());
-    frameScrollingNode.setHeaderHeight(frameView.headerHeight());
-    frameScrollingNode.setFooterHeight(frameView.footerHeight());
-    frameScrollingNode.setTopContentInset(frameView.topContentInset());
-
-    frameScrollingNode.setLayoutViewport(frameView.layoutViewportRect());
-    frameScrollingNode.setAsyncFrameOrOverflowScrollingEnabled(asyncFrameOrOverflowScrollingEnabled());
-
-    frameScrollingNode.setMinLayoutViewportOrigin(frameView.minStableLayoutViewportOrigin());
-    frameScrollingNode.setMaxLayoutViewportOrigin(frameView.maxStableLayoutViewportOrigin());
-
-    frameScrollingNode.setScrollOrigin(frameView.scrollOrigin());
-    frameScrollingNode.setScrollableAreaSize(frameView.visibleContentRect().size());
-    frameScrollingNode.setTotalContentsSize(frameView.totalContentsSize());
-    frameScrollingNode.setReachableContentsSize(frameView.totalContentsSize());
-    frameScrollingNode.setFixedElementsLayoutRelativeToFrame(frameView.fixedElementsLayoutRelativeToFrame());
-    frameScrollingNode.setScrollBehaviorForFixedElements(frameView.scrollBehaviorForFixedElements());
-
-#if ENABLE(CSS_SCROLL_SNAP)
-    frameView.updateSnapOffsets();
-    updateScrollSnapPropertiesWithFrameView(frameView);
-#endif
-
-#if PLATFORM(COCOA)
     auto* page = frameView.frame().page();
     if (page && page->expectsWheelEventTriggers()) {
         LOG(WheelEventTestTriggers, "    AsyncScrollingCoordinator::frameViewLayoutUpdated: Expects wheel event test trigger=%d", page->expectsWheelEventTriggers());
+
+        auto* node = m_scrollingStateTree->stateNodeForID(frameView.scrollingNodeID());
+        if (!is<ScrollingStateFrameScrollingNode>(node))
+            return;
+
+        auto& frameScrollingNode = downcast<ScrollingStateFrameScrollingNode>(*node);
         frameScrollingNode.setExpectsWheelEventTestTrigger(page->expectsWheelEventTriggers());
     }
 #endif
-
-    ScrollableAreaParameters scrollParameters;
-    scrollParameters.horizontalScrollElasticity = frameView.horizontalScrollElasticity();
-    scrollParameters.verticalScrollElasticity = frameView.verticalScrollElasticity();
-    scrollParameters.hasEnabledHorizontalScrollbar = horizontalScrollbar && horizontalScrollbar->enabled();
-    scrollParameters.hasEnabledVerticalScrollbar = verticalScrollbar && verticalScrollbar->enabled();
-    scrollParameters.horizontalScrollbarMode = frameView.horizontalScrollbarMode();
-    scrollParameters.verticalScrollbarMode = frameView.verticalScrollbarMode();
-    scrollParameters.useDarkAppearanceForScrollbars = frameView.useDarkAppearanceForScrollbars();
-
-    frameScrollingNode.setScrollableAreaParameters(scrollParameters);
 }
 
 void AsyncScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView(const FrameView& frameView)
@@ -614,40 +577,90 @@ void AsyncScrollingCoordinator::setNodeLayers(ScrollingNodeID nodeID, const Node
     }
 }
 
-void AsyncScrollingCoordinator::setScrollingNodeGeometry(ScrollingNodeID nodeID, const ScrollingGeometry& scrollingGeometry)
+void AsyncScrollingCoordinator::setRectRelativeToParentNode(ScrollingNodeID nodeID, const LayoutRect& parentRelativeScrollableRect)
 {
     auto* stateNode = m_scrollingStateTree->stateNodeForID(nodeID);
     ASSERT(stateNode);
     if (!stateNode)
         return;
 
-    if (stateNode->nodeType() == ScrollingNodeType::FrameHosting) {
+    if (is<ScrollingStateFrameHostingNode>(*stateNode)) {
         auto& frameHostingStateNode = downcast<ScrollingStateFrameHostingNode>(*stateNode);
-        frameHostingStateNode.setParentRelativeScrollableRect(scrollingGeometry.parentRelativeScrollableRect);
+        frameHostingStateNode.setParentRelativeScrollableRect(parentRelativeScrollableRect);
         return;
     }
 
+    if (is<ScrollingStateScrollingNode>(stateNode)) {
+        auto& scrollingStateNode = downcast<ScrollingStateScrollingNode>(*stateNode);
+        scrollingStateNode.setParentRelativeScrollableRect(parentRelativeScrollableRect);
+    }
+}
+
+void AsyncScrollingCoordinator::setFrameScrollingNodeState(ScrollingNodeID nodeID, const FrameView& frameView)
+{
+    auto* stateNode = m_scrollingStateTree->stateNodeForID(nodeID);
+    ASSERT(stateNode);
+    if (!is<ScrollingStateFrameScrollingNode>(stateNode))
+        return;
+
+    auto& frameScrollingNode = downcast<ScrollingStateFrameScrollingNode>(*stateNode);
+
+    auto* verticalScrollbar = frameView.verticalScrollbar();
+    auto* horizontalScrollbar = frameView.horizontalScrollbar();
+    frameScrollingNode.setScrollerImpsFromScrollbars(verticalScrollbar, horizontalScrollbar);
+
+    frameScrollingNode.setFrameScaleFactor(frameView.frame().frameScaleFactor());
+    frameScrollingNode.setHeaderHeight(frameView.headerHeight());
+    frameScrollingNode.setFooterHeight(frameView.footerHeight());
+    frameScrollingNode.setTopContentInset(frameView.topContentInset());
+    frameScrollingNode.setLayoutViewport(frameView.layoutViewportRect());
+    frameScrollingNode.setAsyncFrameOrOverflowScrollingEnabled(asyncFrameOrOverflowScrollingEnabled());
+
+    frameScrollingNode.setMinLayoutViewportOrigin(frameView.minStableLayoutViewportOrigin());
+    frameScrollingNode.setMaxLayoutViewportOrigin(frameView.maxStableLayoutViewportOrigin());
+
+    frameScrollingNode.setFixedElementsLayoutRelativeToFrame(frameView.fixedElementsLayoutRelativeToFrame());
+    frameScrollingNode.setScrollBehaviorForFixedElements(frameView.scrollBehaviorForFixedElements());
+}
+
+void AsyncScrollingCoordinator::setScrollingNodeScrollableAreaGeometry(ScrollingNodeID nodeID, ScrollableArea& scrollableArea)
+{
+    auto* stateNode = m_scrollingStateTree->stateNodeForID(nodeID);
+    ASSERT(stateNode);
+    if (!stateNode)
+        return;
+
     auto& scrollingNode = downcast<ScrollingStateScrollingNode>(*stateNode);
+    scrollingNode.setScrollOrigin(scrollableArea.scrollOrigin());
+    scrollingNode.setScrollPosition(scrollableArea.scrollPosition());
+    scrollingNode.setTotalContentsSize(scrollableArea.totalContentsSize());
+    scrollingNode.setReachableContentsSize(scrollableArea.reachableTotalContentsSize());
+    scrollingNode.setScrollableAreaSize(scrollableArea.visibleSize());
 
-    scrollingNode.setParentRelativeScrollableRect(scrollingGeometry.parentRelativeScrollableRect);
-    scrollingNode.setScrollOrigin(scrollingGeometry.scrollOrigin);
-    scrollingNode.setScrollPosition(scrollingGeometry.scrollPosition);
-    scrollingNode.setTotalContentsSize(scrollingGeometry.contentSize);
-    scrollingNode.setReachableContentsSize(scrollingGeometry.reachableContentSize);
-    scrollingNode.setScrollableAreaSize(scrollingGeometry.scrollableAreaSize);
+    auto* verticalScrollbar = scrollableArea.verticalScrollbar();
+    auto* horizontalScrollbar = scrollableArea.horizontalScrollbar();
+
+    ScrollableAreaParameters scrollParameters;
+    scrollParameters.horizontalScrollElasticity = scrollableArea.horizontalScrollElasticity();
+    scrollParameters.verticalScrollElasticity = scrollableArea.verticalScrollElasticity();
+    scrollParameters.hasEnabledHorizontalScrollbar = horizontalScrollbar && horizontalScrollbar->enabled();
+    scrollParameters.hasEnabledVerticalScrollbar = verticalScrollbar && verticalScrollbar->enabled();
+    scrollParameters.horizontalScrollbarMode = scrollableArea.horizontalScrollbarMode();
+    scrollParameters.verticalScrollbarMode = scrollableArea.verticalScrollbarMode();
+    scrollParameters.useDarkAppearanceForScrollbars = scrollableArea.useDarkAppearanceForScrollbars();
+
+    scrollingNode.setScrollableAreaParameters(scrollParameters);
 
 #if ENABLE(CSS_SCROLL_SNAP)
-    // updateScrollSnapPropertiesWithFrameView() sets these for frame scrolling nodes. FIXME: Why the difference?
-    if (is<ScrollingStateOverflowScrollingNode>(scrollingNode)) {
-        setStateScrollingNodeSnapOffsetsAsFloat(scrollingNode, ScrollEventAxis::Horizontal, &scrollingGeometry.horizontalSnapOffsets, &scrollingGeometry.horizontalSnapOffsetRanges, m_page->deviceScaleFactor());
-        setStateScrollingNodeSnapOffsetsAsFloat(scrollingNode, ScrollEventAxis::Vertical, &scrollingGeometry.verticalSnapOffsets, &scrollingGeometry.verticalSnapOffsetRanges, m_page->deviceScaleFactor());
-        scrollingNode.setCurrentHorizontalSnapPointIndex(scrollingGeometry.currentHorizontalSnapPointIndex);
-        scrollingNode.setCurrentVerticalSnapPointIndex(scrollingGeometry.currentVerticalSnapPointIndex);
-    }
+    scrollableArea.updateSnapOffsets();
+    setStateScrollingNodeSnapOffsetsAsFloat(scrollingNode, ScrollEventAxis::Horizontal, scrollableArea.horizontalSnapOffsets(), scrollableArea.horizontalSnapOffsetRanges(), m_page->deviceScaleFactor());
+    setStateScrollingNodeSnapOffsetsAsFloat(scrollingNode, ScrollEventAxis::Vertical, scrollableArea.verticalSnapOffsets(), scrollableArea.verticalSnapOffsetRanges(), m_page->deviceScaleFactor());
+    scrollingNode.setCurrentHorizontalSnapPointIndex(scrollableArea.currentHorizontalSnapPointIndex());
+    scrollingNode.setCurrentVerticalSnapPointIndex(scrollableArea.currentVerticalSnapPointIndex());
 #endif
 }
 
-void AsyncScrollingCoordinator::setViewportConstraintedNodeGeometry(ScrollingNodeID nodeID, const ViewportConstraints& constraints)
+void AsyncScrollingCoordinator::setViewportConstraintedNodeConstraints(ScrollingNodeID nodeID, const ViewportConstraints& constraints)
 {
     auto* node = m_scrollingStateTree->stateNodeForID(nodeID);
     if (!node)
index aaba5e1..2b93e70 100644 (file)
@@ -108,8 +108,11 @@ private:
     WEBCORE_EXPORT Vector<ScrollingNodeID> childrenOfNode(ScrollingNodeID) const override;
 
     WEBCORE_EXPORT void setNodeLayers(ScrollingNodeID, const NodeLayers&) override;
-    WEBCORE_EXPORT void setScrollingNodeGeometry(ScrollingNodeID, const ScrollingGeometry&) override;
-    WEBCORE_EXPORT void setViewportConstraintedNodeGeometry(ScrollingNodeID, const ViewportConstraints&) override;
+
+    WEBCORE_EXPORT void setRectRelativeToParentNode(ScrollingNodeID, const LayoutRect&) override;
+    WEBCORE_EXPORT void setScrollingNodeScrollableAreaGeometry(ScrollingNodeID, ScrollableArea&) override;
+    WEBCORE_EXPORT void setFrameScrollingNodeState(ScrollingNodeID, const FrameView&) override;
+    WEBCORE_EXPORT void setViewportConstraintedNodeConstraints(ScrollingNodeID, const ViewportConstraints&) override;
 
     WEBCORE_EXPORT void reconcileScrollingState(FrameView&, const FloatPoint&, const LayoutViewportOriginOrOverrideRect&, bool programmaticScroll, ViewportRectStability, ScrollingLayerPositionAction) override;
     void reconcileScrollPosition(FrameView&, ScrollingLayerPositionAction);
index 2ca1dc9..82cbb7c 100644 (file)
@@ -139,25 +139,10 @@ public:
     };
     virtual void setNodeLayers(ScrollingNodeID, const NodeLayers&) { }
 
-    struct ScrollingGeometry {
-        LayoutRect parentRelativeScrollableRect;
-        FloatSize scrollableAreaSize;
-        FloatSize contentSize;
-        FloatSize reachableContentSize; // Smaller than contentSize when overflow is hidden on one axis.
-        FloatPoint scrollPosition;
-        IntPoint scrollOrigin;
-#if ENABLE(CSS_SCROLL_SNAP)
-        Vector<LayoutUnit> horizontalSnapOffsets;
-        Vector<LayoutUnit> verticalSnapOffsets;
-        Vector<ScrollOffsetRange<LayoutUnit>> horizontalSnapOffsetRanges;
-        Vector<ScrollOffsetRange<LayoutUnit>> verticalSnapOffsetRanges;
-        unsigned currentHorizontalSnapPointIndex;
-        unsigned currentVerticalSnapPointIndex;
-#endif
-    };
-
-    virtual void setScrollingNodeGeometry(ScrollingNodeID, const ScrollingGeometry&) { }
-    virtual void setViewportConstraintedNodeGeometry(ScrollingNodeID, const ViewportConstraints&) { }
+    virtual void setRectRelativeToParentNode(ScrollingNodeID, const LayoutRect&) { }
+    virtual void setScrollingNodeScrollableAreaGeometry(ScrollingNodeID, ScrollableArea&) { }
+    virtual void setFrameScrollingNodeState(ScrollingNodeID, const FrameView&) { }
+    virtual void setViewportConstraintedNodeConstraints(ScrollingNodeID, const ViewportConstraints&) { }
 
     virtual void reconcileViewportConstrainedLayerPositions(ScrollingNodeID, const LayoutRect&, ScrollingLayerPositionAction) { }
     virtual String scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior = ScrollingStateTreeAsTextBehaviorNormal) const;
index 8cf3e57..87bca2d 100644 (file)
@@ -110,8 +110,8 @@ public:
     void setHorizontalScrollbarMode(ScrollbarMode mode, bool lock = false) { setScrollbarModes(mode, verticalScrollbarMode(), lock, verticalScrollbarLock()); }
     void setVerticalScrollbarMode(ScrollbarMode mode, bool lock = false) { setScrollbarModes(horizontalScrollbarMode(), mode, horizontalScrollbarLock(), lock); };
     WEBCORE_EXPORT void scrollbarModes(ScrollbarMode& horizontalMode, ScrollbarMode& verticalMode) const;
-    ScrollbarMode horizontalScrollbarMode() const { ScrollbarMode horizontal, vertical; scrollbarModes(horizontal, vertical); return horizontal; }
-    ScrollbarMode verticalScrollbarMode() const { ScrollbarMode horizontal, vertical; scrollbarModes(horizontal, vertical); return vertical; }
+    ScrollbarMode horizontalScrollbarMode() const final { ScrollbarMode horizontal, vertical; scrollbarModes(horizontal, vertical); return horizontal; }
+    ScrollbarMode verticalScrollbarMode() const final { ScrollbarMode horizontal, vertical; scrollbarModes(horizontal, vertical); return vertical; }
 
     void setHorizontalScrollbarLock(bool lock = true) { m_horizontalScrollbarLock = lock; }
     bool horizontalScrollbarLock() const { return m_horizontalScrollbarLock; }
index efb76e8..e95f23a 100644 (file)
@@ -669,6 +669,11 @@ void ScrollableArea::scrollbarStyleChanged(ScrollbarStyle, bool)
     availableContentSizeChanged(AvailableSizeChangeReason::ScrollbarsChanged);
 }
 
+IntSize ScrollableArea::reachableTotalContentsSize() const
+{
+    return totalContentsSize();
+}
+
 IntSize ScrollableArea::totalContentsSize() const
 {
     IntSize totalContentsSize = contentsSize();
index 01b64e9..6e26795 100644 (file)
@@ -107,6 +107,9 @@ public:
     void setHorizontalScrollElasticity(ScrollElasticity scrollElasticity) { m_horizontalScrollElasticity = scrollElasticity; }
     ScrollElasticity horizontalScrollElasticity() const { return static_cast<ScrollElasticity>(m_horizontalScrollElasticity); }
 
+    virtual ScrollbarMode horizontalScrollbarMode() const { return ScrollbarAuto; }
+    virtual ScrollbarMode verticalScrollbarMode() const { return ScrollbarAuto; }
+
     bool inLiveResize() const { return m_inLiveResize; }
     WEBCORE_EXPORT virtual void willStartLiveResize();
     WEBCORE_EXPORT virtual void willEndLiveResize();
@@ -253,6 +256,7 @@ public:
 
     // The totalContentsSize() is equivalent to the contentsSize() plus the header and footer heights.
     WEBCORE_EXPORT IntSize totalContentsSize() const;
+    WEBCORE_EXPORT virtual IntSize reachableTotalContentsSize() const;
 
     virtual bool useDarkAppearance() const { return false; }
 
index 69cb493..a62564d 100644 (file)
@@ -2813,15 +2813,16 @@ IntSize RenderLayer::overhangAmount() const
 
     // FIXME: use maximumScrollOffset(), or just move this to ScrollableArea.
     ScrollOffset scrollOffset = scrollOffsetFromPosition(scrollPosition());
+    auto reachableSize = reachableTotalContentsSize();
     if (scrollOffset.y() < 0)
         stretch.setHeight(scrollOffset.y());
-    else if (scrollableContentsSize().height() && scrollOffset.y() > scrollableContentsSize().height() - visibleHeight())
-        stretch.setHeight(scrollOffset.y() - (scrollableContentsSize().height() - visibleHeight()));
+    else if (reachableSize.height() && scrollOffset.y() > reachableSize.height() - visibleHeight())
+        stretch.setHeight(scrollOffset.y() - (reachableSize.height() - visibleHeight()));
 
     if (scrollOffset.x() < 0)
         stretch.setWidth(scrollOffset.x());
-    else if (scrollableContentsSize().width() && scrollOffset.x() > scrollableContentsSize().width() - visibleWidth())
-        stretch.setWidth(scrollOffset.x() - (scrollableContentsSize().width() - visibleWidth()));
+    else if (reachableSize.width() && scrollOffset.x() > reachableSize.width() - visibleWidth())
+        stretch.setWidth(scrollOffset.x() - (reachableSize.width() - visibleWidth()));
 
     return stretch;
 #else
@@ -2948,7 +2949,7 @@ IntSize RenderLayer::contentsSize() const
     return IntSize(scrollWidth(), scrollHeight());
 }
 
-IntSize RenderLayer::scrollableContentsSize() const
+IntSize RenderLayer::reachableTotalContentsSize() const
 {
     IntSize contentsSize = this->contentsSize();
 
index ccfcc4e..50a36f2 100644 (file)
@@ -399,6 +399,7 @@ public:
 
     IntSize visibleSize() const override;
     IntSize contentsSize() const override;
+    IntSize reachableTotalContentsSize() const override;
 
     int scrollWidth() const;
     int scrollHeight() const;
@@ -419,7 +420,6 @@ public:
     void applyPostLayoutScrollPositionIfNeeded();
 
     ScrollOffset scrollOffset() const { return scrollOffsetFromPosition(m_scrollPosition); }
-    IntSize scrollableContentsSize() const;
 
     void availableContentSizeChanged(AvailableSizeChangeReason) override;
 
index acadc78..3e8d2a7 100644 (file)
@@ -700,6 +700,11 @@ bool RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType update
         updateRoot->setDescendantsNeedCompositingRequirementsTraversal();
     }
 
+    if (updateType == CompositingUpdateType::AfterLayout) {
+        // Ensure that post-layout updates push new scroll position and viewport rects onto the root node.
+        rootRenderLayer().setNeedsScrollingTreeUpdate();
+    }
+
     if (!updateRoot->hasDescendantNeedingCompositingRequirementsTraversal() && !m_compositing) {
         LOG_WITH_STREAM(Compositing, stream << " no compositing work to do");
         return true;
@@ -1171,10 +1176,11 @@ void RenderLayerCompositor::updateBackingAndHierarchy(RenderLayer& layer, Vector
         }
         
         OptionSet<ScrollingNodeChangeFlags> scrollingNodeChanges = { ScrollingNodeChangeFlags::Layer };
-        if (layerNeedsUpdate || layer.needsCompositingGeometryUpdate() || layer.needsScrollingTreeUpdate()) {
+        if (layerNeedsUpdate || layer.needsCompositingGeometryUpdate()) {
             layerBacking->updateGeometry();
             scrollingNodeChanges.add(ScrollingNodeChangeFlags::LayerGeometry);
-        }
+        } else if (layer.needsScrollingTreeUpdate())
+            scrollingNodeChanges.add(ScrollingNodeChangeFlags::LayerGeometry);
 
         if (auto* reflection = layer.reflectionLayer()) {
             if (auto* reflectionBacking = reflection->backing()) {
@@ -3922,10 +3928,10 @@ ScrollingNodeID RenderLayerCompositor::updateScrollingNodeForViewportConstrained
     if (changes & ScrollingNodeChangeFlags::LayerGeometry) {
         switch (nodeType) {
         case ScrollingNodeType::Fixed:
-            scrollingCoordinator->setViewportConstraintedNodeGeometry(newNodeID, computeFixedViewportConstraints(layer));
+            scrollingCoordinator->setViewportConstraintedNodeConstraints(newNodeID, computeFixedViewportConstraints(layer));
             break;
         case ScrollingNodeType::Sticky:
-            scrollingCoordinator->setViewportConstraintedNodeGeometry(newNodeID, computeStickyViewportConstraints(layer));
+            scrollingCoordinator->setViewportConstraintedNodeConstraints(newNodeID, computeStickyViewportConstraints(layer));
             break;
         case ScrollingNodeType::MainFrame:
         case ScrollingNodeType::Subframe:
@@ -3938,69 +3944,29 @@ ScrollingNodeID RenderLayerCompositor::updateScrollingNodeForViewportConstrained
     return newNodeID;
 }
 
-void RenderLayerCompositor::computeFrameScrollingGeometry(ScrollingCoordinator::ScrollingGeometry& scrollingGeometry) const
+LayoutRect RenderLayerCompositor::rootParentRelativeScrollableRect() const
 {
     auto& frameView = m_renderView.frameView();
 
     if (m_renderView.frame().isMainFrame())
-        scrollingGeometry.parentRelativeScrollableRect = frameView.frameRect();
-    else
-        scrollingGeometry.parentRelativeScrollableRect = LayoutRect({ }, LayoutSize(frameView.size()));
-
-    scrollingGeometry.scrollOrigin = frameView.scrollOrigin();
-    scrollingGeometry.scrollableAreaSize = frameView.visibleContentRect().size();
-    scrollingGeometry.contentSize = frameView.totalContentsSize();
-    scrollingGeometry.reachableContentSize = frameView.totalContentsSize();
-#if ENABLE(CSS_SCROLL_SNAP)
-    frameView.updateSnapOffsets();
-    updateScrollSnapPropertiesWithFrameView(frameView);
-#endif
-}
-
-void RenderLayerCompositor::computeFrameHostingGeometry(const RenderLayer& layer, const RenderLayer* ancestorLayer, ScrollingCoordinator::ScrollingGeometry& scrollingGeometry) const
-{
-    // FIXME: ancestorLayer needs to be always non-null, so should become a reference.
-    if (ancestorLayer) {
-        LayoutRect scrollableRect;
-        if (is<RenderBox>(layer.renderer()))
-            scrollableRect = downcast<RenderBox>(layer.renderer()).paddingBoxRect();
-
-        auto offset = layer.convertToLayerCoords(ancestorLayer, scrollableRect.location()); // FIXME: broken for columns.
-        scrollableRect.setLocation(offset);
-        scrollingGeometry.parentRelativeScrollableRect = scrollableRect;
-    }
+        return frameView.frameRect();
+    
+    return LayoutRect({ }, LayoutSize(frameView.size()));
 }
 
-void RenderLayerCompositor::computeOverflowScrollingGeometry(const RenderLayer& layer, const RenderLayer* ancestorLayer, ScrollingCoordinator::ScrollingGeometry& scrollingGeometry) const
+LayoutRect RenderLayerCompositor::parentRelativeScrollableRect(const RenderLayer& layer, const RenderLayer* ancestorLayer) const
 {
     // FIXME: ancestorLayer needs to be always non-null, so should become a reference.
-    if (ancestorLayer) {
-        LayoutRect scrollableRect;
-        if (is<RenderBox>(layer.renderer()))
-            scrollableRect = downcast<RenderBox>(layer.renderer()).paddingBoxRect();
+    if (!ancestorLayer)
+        return LayoutRect({ }, LayoutSize(layer.visibleSize()));
 
-        auto offset = layer.convertToLayerCoords(ancestorLayer, scrollableRect.location()); // FIXME: broken for columns.
-        scrollableRect.setLocation(offset);
-        scrollingGeometry.parentRelativeScrollableRect = scrollableRect;
-    }
+    LayoutRect scrollableRect;
+    if (is<RenderBox>(layer.renderer()))
+        scrollableRect = downcast<RenderBox>(layer.renderer()).paddingBoxRect();
 
-    scrollingGeometry.scrollOrigin = layer.scrollOrigin();
-    scrollingGeometry.scrollPosition = layer.scrollPosition();
-    scrollingGeometry.scrollableAreaSize = layer.visibleSize();
-    scrollingGeometry.contentSize = layer.contentsSize();
-    scrollingGeometry.reachableContentSize = layer.scrollableContentsSize();
-#if ENABLE(CSS_SCROLL_SNAP)
-    if (auto* offsets = layer.horizontalSnapOffsets())
-        scrollingGeometry.horizontalSnapOffsets = *offsets;
-    if (auto* offsets = layer.verticalSnapOffsets())
-        scrollingGeometry.verticalSnapOffsets = *offsets;
-    if (auto* ranges = layer.horizontalSnapOffsetRanges())
-        scrollingGeometry.horizontalSnapOffsetRanges = *ranges;
-    if (auto* ranges = layer.verticalSnapOffsetRanges())
-        scrollingGeometry.verticalSnapOffsetRanges = *ranges;
-    scrollingGeometry.currentHorizontalSnapPointIndex = layer.currentHorizontalSnapPointIndex();
-    scrollingGeometry.currentVerticalSnapPointIndex = layer.currentVerticalSnapPointIndex();
-#endif
+    auto offset = layer.convertToLayerCoords(ancestorLayer, scrollableRect.location()); // FIXME: broken for columns.
+    scrollableRect.setLocation(offset);
+    return scrollableRect;
 }
 
 ScrollingNodeID RenderLayerCompositor::updateScrollingNodeForScrollingRole(RenderLayer& layer, ScrollingTreeState& treeState, OptionSet<ScrollingNodeChangeFlags> changes)
@@ -4024,9 +3990,9 @@ ScrollingNodeID RenderLayerCompositor::updateScrollingNodeForScrollingRole(Rende
             scrollingCoordinator->setNodeLayers(newNodeID, { nullptr, scrollContainerLayer(), scrolledContentsLayer(), fixedRootBackgroundLayer(), clipLayer(), rootContentsLayer() });
 
         if (changes & ScrollingNodeChangeFlags::LayerGeometry) {
-            ScrollingCoordinator::ScrollingGeometry scrollingGeometry;
-            computeFrameScrollingGeometry(scrollingGeometry);
-            scrollingCoordinator->setScrollingNodeGeometry(newNodeID, scrollingGeometry);
+            scrollingCoordinator->setRectRelativeToParentNode(newNodeID, rootParentRelativeScrollableRect());
+            scrollingCoordinator->setScrollingNodeScrollableAreaGeometry(newNodeID, frameView);
+            scrollingCoordinator->setFrameScrollingNodeState(newNodeID, frameView);
         }
     } else {
         newNodeID = attachScrollingNode(layer, ScrollingNodeType::Overflow, treeState);
@@ -4040,9 +4006,8 @@ ScrollingNodeID RenderLayerCompositor::updateScrollingNodeForScrollingRole(Rende
 
         if (changes & ScrollingNodeChangeFlags::LayerGeometry && treeState.parentNodeID) {
             RenderLayer* scrollingAncestorLayer = m_scrollingNodeToLayerMap.get(treeState.parentNodeID.value());
-            ScrollingCoordinator::ScrollingGeometry scrollingGeometry;
-            computeOverflowScrollingGeometry(layer, scrollingAncestorLayer, scrollingGeometry);
-            scrollingCoordinator->setScrollingNodeGeometry(newNodeID, scrollingGeometry);
+            scrollingCoordinator->setRectRelativeToParentNode(newNodeID, parentRelativeScrollableRect(layer, scrollingAncestorLayer));
+            scrollingCoordinator->setScrollingNodeScrollableAreaGeometry(newNodeID, layer);
         }
     }
 
@@ -4064,9 +4029,7 @@ ScrollingNodeID RenderLayerCompositor::updateScrollingNodeForFrameHostingRole(Re
 
     if (changes & ScrollingNodeChangeFlags::LayerGeometry && treeState.parentNodeID) {
         RenderLayer* scrollingAncestorLayer = m_scrollingNodeToLayerMap.get(treeState.parentNodeID.value());
-        ScrollingCoordinator::ScrollingGeometry scrollingGeometry;
-        computeFrameHostingGeometry(layer, scrollingAncestorLayer, scrollingGeometry);
-        scrollingCoordinator->setScrollingNodeGeometry(newNodeID, scrollingGeometry);
+        scrollingCoordinator->setRectRelativeToParentNode(newNodeID, parentRelativeScrollableRect(layer, scrollingAncestorLayer));
     }
 
     return newNodeID;
@@ -4284,7 +4247,7 @@ void LegacyWebKitScrollingLayerCoordinator::updateScrollingLayer(RenderLayer& la
     bool allowHorizontalScrollbar = !scrollbarHasDisplayNone(layer.horizontalScrollbar());
     bool allowVerticalScrollbar = !scrollbarHasDisplayNone(layer.verticalScrollbar());
     m_chromeClient.addOrUpdateScrollingLayer(layer.renderer().element(), backing->scrollContainerLayer()->platformLayer(), backing->scrolledContentsLayer()->platformLayer(),
-        layer.scrollableContentsSize(), allowHorizontalScrollbar, allowVerticalScrollbar);
+        layer.reachableTotalContentsSize(), allowHorizontalScrollbar, allowVerticalScrollbar);
 }
 
 void LegacyWebKitScrollingLayerCoordinator::registerAllScrollingLayers()
index 8694533..493e078 100644 (file)
@@ -498,9 +498,8 @@ private:
     FixedPositionViewportConstraints computeFixedViewportConstraints(RenderLayer&) const;
     StickyPositionViewportConstraints computeStickyViewportConstraints(RenderLayer&) const;
 
-    void computeFrameScrollingGeometry(ScrollingCoordinator::ScrollingGeometry&) const;
-    void computeFrameHostingGeometry(const RenderLayer&, const RenderLayer* ancestorLayer, ScrollingCoordinator::ScrollingGeometry&) const;
-    void computeOverflowScrollingGeometry(const RenderLayer&, const RenderLayer* ancestorLayer, ScrollingCoordinator::ScrollingGeometry&) const;
+    LayoutRect rootParentRelativeScrollableRect() const;
+    LayoutRect parentRelativeScrollableRect(const RenderLayer&, const RenderLayer* ancestorLayer) const;
 
     bool requiresScrollLayer(RootLayerAttachment) const;
     bool requiresHorizontalScrollbarLayer() const;