Changeset 242333 in webkit


Ignore:
Timestamp:
Mar 3, 2019, 4:36:57 PM (6 years ago)
Author:
Simon Fraser
Message:

Share more code for updating the state of frame scrolling nodes
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:
Location:
trunk
Files:
44 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r242331 r242333  
     12019-03-02  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Share more code for updating the state of frame scrolling nodes
     4        https://bugs.webkit.org/show_bug.cgi?id=195254
     5
     6        Reviewed by Antti Koivisto.
     7       
     8        New baselines. Overflow nodes get some state from ScrollableAreaParameters now, and
     9        frame nodes get the current scroll position (which is good, since they already have
     10        the new layout viewport).
     11
     12        * fast/scrolling/ios/change-scrollability-on-content-resize-expected.txt:
     13        * fast/scrolling/ios/change-scrollability-on-content-resize-nested-expected.txt:
     14        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-expected.txt:
     15        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-gain-scrolling-ancestor-expected.txt:
     16        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-in-fixed-expected.txt:
     17        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-lose-scrolling-ancestor-expected.txt:
     18        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/gain-scrolling-node-parent-expected.txt:
     19        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/lose-scrolling-node-parent-expected.txt:
     20        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/overflow-in-fixed-expected.txt:
     21        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/remove-scrolling-role-expected.txt:
     22        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/reparent-across-compositing-layers-expected.txt:
     23        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/reparent-with-layer-removal-expected.txt:
     24        * scrollingcoordinator/scrolling-tree/gain-scrolling-node-parent-expected.txt:
     25        * scrollingcoordinator/scrolling-tree/lose-scrolling-node-parent-expected.txt:
     26        * scrollingcoordinator/scrolling-tree/overflow-in-fixed-expected.txt:
     27        * scrollingcoordinator/scrolling-tree/remove-scrolling-role-expected.txt:
     28        * scrollingcoordinator/scrolling-tree/reparent-across-compositing-layers-expected.txt:
     29        * scrollingcoordinator/scrolling-tree/reparent-with-layer-removal-expected.txt:
     30        * tiled-drawing/scrolling/clamp-out-of-bounds-scrolls-expected.txt:
     31        * tiled-drawing/scrolling/fixed/absolute-inside-fixed-expected.txt:
     32        * tiled-drawing/scrolling/fixed/absolute-inside-out-of-view-fixed-expected.txt:
     33        * tiled-drawing/scrolling/fixed/fixed-in-overflow-expected.txt:
     34        * tiled-drawing/scrolling/fixed/four-bars-expected.txt:
     35        * tiled-drawing/scrolling/fixed/four-bars-with-header-and-footer-expected.txt:
     36        * tiled-drawing/scrolling/fixed/four-bars.html:
     37        * tiled-drawing/scrolling/fixed/nested-fixed-expected.txt:
     38        * tiled-drawing/scrolling/fixed/percentage-inside-fixed-expected.txt:
     39        * tiled-drawing/scrolling/sticky/sticky-horizontal-expected.txt:
     40        * tiled-drawing/scrolling/sticky/sticky-vertical-expected.txt:
     41
    1422019-03-03  Diego Pino Garcia  <dpino@igalia.com>
    243
  • trunk/LayoutTests/fast/scrolling/ios/change-scrollability-on-content-resize-expected.txt

    r241934 r242333  
    162162        (vertical scroll elasticity 1)
    163163        (horizontal scrollbar mode 0)
    164         (vertical scrollbar mode 0))
     164        (vertical scrollbar mode 0)
     165        (has enabled vertical scrollbar 1))
    165166    )
    166167    (Overflow scrolling node
     
    172173        (vertical scroll elasticity 1)
    173174        (horizontal scrollbar mode 0)
    174         (vertical scrollbar mode 0))
     175        (vertical scrollbar mode 0)
     176        (has enabled vertical scrollbar 1))
    175177    )
    176178  )
  • trunk/LayoutTests/fast/scrolling/ios/change-scrollability-on-content-resize-nested-expected.txt

    r241934 r242333  
    8787        (vertical scroll elasticity 1)
    8888        (horizontal scrollbar mode 0)
    89         (vertical scrollbar mode 0))
     89        (vertical scrollbar mode 0)
     90        (has enabled vertical scrollbar 1))
    9091    )
    9192  )
  • trunk/LayoutTests/fast/visual-viewport/tiled-drawing/zoomed-fixed-scrolled-down-expected.txt

    r241934 r242333  
    11
    22(Frame scrolling node
     3  (scroll position 40 1000)
    34  (scrollable area size 785 585)
    45  (contents size 4016 4042)
  • trunk/LayoutTests/fast/visual-viewport/tiled-drawing/zoomed-fixed-scrolled-down-then-up-expected.txt

    r241934 r242333  
    11
    22(Frame scrolling node
     3  (scroll position 40 460)
    34  (scrollable area size 785 585)
    45  (contents size 4016 4042)
  • trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-expected.txt

    r241934 r242333  
    3939                (vertical scroll elasticity 1)
    4040                (horizontal scrollbar mode 0)
    41                 (vertical scrollbar mode 0))
     41                (vertical scrollbar mode 0)
     42                (has enabled vertical scrollbar 1))
    4243              (children 1
    4344                (Sticky node
  • trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-gain-scrolling-ancestor-expected.txt

    r241934 r242333  
    4444                    (vertical scroll elasticity 1)
    4545                    (horizontal scrollbar mode 0)
    46                     (vertical scrollbar mode 0))
     46                    (vertical scrollbar mode 0)
     47                    (has enabled vertical scrollbar 1))
    4748                  (children 1
    4849                    (Sticky node
  • trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-in-fixed-expected.txt

    r241934 r242333  
    4444                    (vertical scroll elasticity 1)
    4545                    (horizontal scrollbar mode 0)
    46                     (vertical scrollbar mode 0))
     46                    (vertical scrollbar mode 0)
     47                    (has enabled vertical scrollbar 1))
    4748                  (children 1
    4849                    (Sticky node
  • trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-lose-scrolling-ancestor-expected.txt

    r241934 r242333  
    3939                (vertical scroll elasticity 1)
    4040                (horizontal scrollbar mode 0)
    41                 (vertical scrollbar mode 0))
     41                (vertical scrollbar mode 0)
     42                (has enabled vertical scrollbar 1))
    4243              (children 1
    4344                (Sticky node
  • trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/fixed-inside-frame-expected.txt

    r241934 r242333  
    1919      (children 1
    2020        (Frame scrolling node
     21          (scroll position 0 120)
    2122          (scrollable area size 480 400)
    2223          (contents size 480 1016)
  • trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/gain-scrolling-node-parent-expected.txt

    r241934 r242333  
    2525        (vertical scroll elasticity 1)
    2626        (horizontal scrollbar mode 0)
    27         (vertical scrollbar mode 0))
     27        (vertical scrollbar mode 0)
     28        (has enabled horizontal scrollbar 1)
     29        (has enabled vertical scrollbar 1))
    2830      (children 1
    2931        (Overflow scrolling node
     
    3537            (vertical scroll elasticity 1)
    3638            (horizontal scrollbar mode 0)
    37             (vertical scrollbar mode 0))
     39            (vertical scrollbar mode 0)
     40            (has enabled vertical scrollbar 1))
    3841        )
    3942      )
  • trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/lose-scrolling-node-parent-expected.txt

    r241934 r242333  
    2525        (vertical scroll elasticity 1)
    2626        (horizontal scrollbar mode 0)
    27         (vertical scrollbar mode 0))
     27        (vertical scrollbar mode 0)
     28        (has enabled horizontal scrollbar 1)
     29        (has enabled vertical scrollbar 1))
    2830      (children 1
    2931        (Overflow scrolling node
     
    3537            (vertical scroll elasticity 1)
    3638            (horizontal scrollbar mode 0)
    37             (vertical scrollbar mode 0))
     39            (vertical scrollbar mode 0)
     40            (has enabled vertical scrollbar 1))
    3841        )
    3942      )
  • trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/overflow-in-fixed-expected.txt

    r241934 r242333  
    2828            (vertical scroll elasticity 1)
    2929            (horizontal scrollbar mode 0)
    30             (vertical scrollbar mode 0))
     30            (vertical scrollbar mode 0)
     31            (has enabled vertical scrollbar 1))
    3132        )
    3233      )
  • trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/remove-scrolling-role-expected.txt

    r241934 r242333  
    2222        (vertical scroll elasticity 1)
    2323        (horizontal scrollbar mode 0)
    24         (vertical scrollbar mode 0))
     24        (vertical scrollbar mode 0)
     25        (has enabled vertical scrollbar 1))
    2526    )
    2627  )
  • trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/reparent-across-compositing-layers-expected.txt

    r241934 r242333  
    2525        (vertical scroll elasticity 1)
    2626        (horizontal scrollbar mode 0)
    27         (vertical scrollbar mode 0))
     27        (vertical scrollbar mode 0)
     28        (has enabled vertical scrollbar 1))
    2829    )
    2930  )
  • trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/reparent-with-layer-removal-expected.txt

    r241934 r242333  
    2525        (vertical scroll elasticity 1)
    2626        (horizontal scrollbar mode 0)
    27         (vertical scrollbar mode 0))
     27        (vertical scrollbar mode 0)
     28        (has enabled vertical scrollbar 1))
    2829    )
    2930  )
  • trunk/LayoutTests/scrollingcoordinator/scrolling-tree/gain-scrolling-node-parent-expected.txt

    r241934 r242333  
    2222      (parent relative scrollable rect at (9,9) size 405x305)
    2323      (scrollable area parameters
    24         (horizontal scroll elasticity 1)
    25         (vertical scroll elasticity 1)
     24        (horizontal scroll elasticity 0)
     25        (vertical scroll elasticity 0)
    2626        (horizontal scrollbar mode 0)
    27         (vertical scrollbar mode 0))
     27        (vertical scrollbar mode 0)
     28        (has enabled horizontal scrollbar 1)
     29        (has enabled vertical scrollbar 1))
    2830      (children 1
    2931        (Overflow scrolling node
     
    3234          (parent relative scrollable rect at (23,59) size 405x305)
    3335          (scrollable area parameters
    34             (horizontal scroll elasticity 1)
    35             (vertical scroll elasticity 1)
     36            (horizontal scroll elasticity 0)
     37            (vertical scroll elasticity 0)
    3638            (horizontal scrollbar mode 0)
    37             (vertical scrollbar mode 0))
     39            (vertical scrollbar mode 0)
     40            (has enabled vertical scrollbar 1))
    3841        )
    3942      )
  • trunk/LayoutTests/scrollingcoordinator/scrolling-tree/lose-scrolling-node-parent-expected.txt

    r241934 r242333  
    2222      (parent relative scrollable rect at (9,9) size 405x305)
    2323      (scrollable area parameters
    24         (horizontal scroll elasticity 1)
    25         (vertical scroll elasticity 1)
     24        (horizontal scroll elasticity 0)
     25        (vertical scroll elasticity 0)
    2626        (horizontal scrollbar mode 0)
    27         (vertical scrollbar mode 0))
     27        (vertical scrollbar mode 0)
     28        (has enabled horizontal scrollbar 1)
     29        (has enabled vertical scrollbar 1))
    2830      (children 1
    2931        (Overflow scrolling node
     
    3234          (parent relative scrollable rect at (23,59) size 405x305)
    3335          (scrollable area parameters
    34             (horizontal scroll elasticity 1)
    35             (vertical scroll elasticity 1)
     36            (horizontal scroll elasticity 0)
     37            (vertical scroll elasticity 0)
    3638            (horizontal scrollbar mode 0)
    37             (vertical scrollbar mode 0))
     39            (vertical scrollbar mode 0)
     40            (has enabled vertical scrollbar 1))
    3841        )
    3942      )
  • trunk/LayoutTests/scrollingcoordinator/scrolling-tree/overflow-in-fixed-expected.txt

    r241934 r242333  
    2525          (parent relative scrollable rect at (0,0) size 385x285)
    2626          (scrollable area parameters
    27             (horizontal scroll elasticity 1)
    28             (vertical scroll elasticity 1)
     27            (horizontal scroll elasticity 0)
     28            (vertical scroll elasticity 0)
    2929            (horizontal scrollbar mode 0)
    30             (vertical scrollbar mode 0))
     30            (vertical scrollbar mode 0)
     31            (has enabled vertical scrollbar 1))
    3132        )
    3233      )
  • trunk/LayoutTests/scrollingcoordinator/scrolling-tree/remove-scrolling-role-expected.txt

    r241934 r242333  
    2121      (scrollable area parameters
    2222        (horizontal scroll elasticity 1)
    23         (vertical scroll elasticity 1)
     23        (vertical scroll elasticity 0)
    2424        (horizontal scrollbar mode 0)
    25         (vertical scrollbar mode 0))
     25        (vertical scrollbar mode 0)
     26        (has enabled vertical scrollbar 1))
    2627    )
    2728  )
  • trunk/LayoutTests/scrollingcoordinator/scrolling-tree/reparent-across-compositing-layers-expected.txt

    r241934 r242333  
    2222      (parent relative scrollable rect at (70,98) size 425x325)
    2323      (scrollable area parameters
    24         (horizontal scroll elasticity 1)
    25         (vertical scroll elasticity 1)
     24        (horizontal scroll elasticity 0)
     25        (vertical scroll elasticity 0)
    2626        (horizontal scrollbar mode 0)
    27         (vertical scrollbar mode 0))
     27        (vertical scrollbar mode 0)
     28        (has enabled vertical scrollbar 1))
    2829    )
    2930  )
  • trunk/LayoutTests/scrollingcoordinator/scrolling-tree/reparent-with-layer-removal-expected.txt

    r241934 r242333  
    2323      (parent relative scrollable rect at (70,98) size 425x325)
    2424      (scrollable area parameters
    25         (horizontal scroll elasticity 1)
    26         (vertical scroll elasticity 1)
     25        (horizontal scroll elasticity 0)
     26        (vertical scroll elasticity 0)
    2727        (horizontal scrollbar mode 0)
    28         (vertical scrollbar mode 0))
     28        (vertical scrollbar mode 0)
     29        (has enabled vertical scrollbar 1))
    2930    )
    3031  )
  • trunk/LayoutTests/tiled-drawing/scrolling/clamp-out-of-bounds-scrolls-expected.txt

    r241934 r242333  
    8080
    8181(Frame scrolling node
     82  (scroll position 4223 0)
    8283  (scrollable area size 785 585)
    8384  (contents size 5008 5021)
     
    101102
    102103(Frame scrolling node
     104  (scroll position 0 4436)
    103105  (scrollable area size 785 585)
    104106  (contents size 5008 5021)
  • trunk/LayoutTests/tiled-drawing/scrolling/fixed/absolute-inside-fixed-expected.txt

    r241934 r242333  
    11
    22(Frame scrolling node
     3  (scroll position 0 200)
    34  (scrollable area size 785 600)
    45  (contents size 785 2710)
  • trunk/LayoutTests/tiled-drawing/scrolling/fixed/absolute-inside-out-of-view-fixed-expected.txt

    r241934 r242333  
    11
    22(Frame scrolling node
     3  (scroll position 0 200)
    34  (scrollable area size 785 600)
    45  (contents size 785 2513)
  • trunk/LayoutTests/tiled-drawing/scrolling/fixed/fixed-in-overflow-expected.txt

    r241934 r242333  
    11
    22(Frame scrolling node
     3  (scroll position 0 200)
    34  (scrollable area size 785 600)
    45  (contents size 785 2213)
  • trunk/LayoutTests/tiled-drawing/scrolling/fixed/four-bars-expected.txt

    r241934 r242333  
    11
    22(Frame scrolling node
     3  (scroll position 0 200)
    34  (scrollable area size 785 600)
    45  (contents size 785 2221)
  • trunk/LayoutTests/tiled-drawing/scrolling/fixed/four-bars-with-header-and-footer-expected.txt

    r241934 r242333  
    11
    22(Frame scrolling node
     3  (scroll position 0 200)
    34  (scrollable area size 785 600)
    45  (contents size 785 2421)
  • trunk/LayoutTests/tiled-drawing/scrolling/fixed/four-bars.html

    r187905 r242333  
    33<html>
    44<head>
    5     <meta name="apple-mobile-web-app-capable" content="yes">
    6     <style type="text/css" media="screen">
     5    <style>
    76      body {
    87        height: 2200px;
     
    1716        background-color: rgba(0, 128, 0, 0.8);
    1817        border: 2px solid black;
    19         -webkit-box-shadow: 0 0 10px black;
     18        box-shadow: 0 0 10px black;
    2019      }
    2120     
     
    4544     
    4645    </style>
    47     <script type="text/javascript" charset="utf-8">
     46    <script>
    4847      if (window.testRunner) {
    4948        testRunner.waitUntilDone();
  • trunk/LayoutTests/tiled-drawing/scrolling/fixed/nested-fixed-expected.txt

    r241934 r242333  
    11
    22(Frame scrolling node
     3  (scroll position 0 200)
    34  (scrollable area size 785 600)
    45  (contents size 785 2213)
  • trunk/LayoutTests/tiled-drawing/scrolling/fixed/percentage-inside-fixed-expected.txt

    r241934 r242333  
    11
    22(Frame scrolling node
     3  (scroll position 0 200)
    34  (scrollable area size 785 600)
    45  (contents size 785 2513)
  • trunk/LayoutTests/tiled-drawing/scrolling/sticky/sticky-horizontal-expected.txt

    r241934 r242333  
    22
    33(Frame scrolling node
     4  (scroll position 800 0)
    45  (scrollable area size 800 585)
    56  (contents size 2008 585)
  • trunk/LayoutTests/tiled-drawing/scrolling/sticky/sticky-vertical-expected.txt

    r241934 r242333  
    66
    77(Frame scrolling node
     8  (scroll position 0 580)
    89  (scrollable area size 785 600)
    910  (contents size 785 2908)
  • trunk/Source/WebCore/ChangeLog

    r242330 r242333  
     12019-03-02  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Share more code for updating the state of frame scrolling nodes
     4        https://bugs.webkit.org/show_bug.cgi?id=195254
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Responsibility for updating state on ScrollingStateFrameScrolling nodes was split between
     9        AsyncScrollingCoordinator::frameViewLayoutUpdated(), which is called post-layout, and
     10        RenderLayerCompositor. This patch gives that responsibility entirely to RenderLayerCompositor,
     11        ensuring that we update frame scrolling nodes at the same time as the rest of the scrolling
     12        state tree.
     13       
     14        We also share code between updating ScrollingStateFrameScrollingNodes and
     15        ScrollingStateOverflowScrollingNodews, since both can be updated from a ScrollableArea.
     16        Some minor cleanup of ScrollableArea is doing to help. For the first time, we're pushing
     17        ScrollableAreaParameters for overflow scrolling nodes, allowing rubber-banding to work
     18        on macOS.
     19
     20        * page/scrolling/AsyncScrollingCoordinator.cpp:
     21        (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
     22        (WebCore::AsyncScrollingCoordinator::setRectRelativeToParentNode):
     23        (WebCore::AsyncScrollingCoordinator::setFrameScrollingNodeState):
     24        (WebCore::AsyncScrollingCoordinator::setScrollingNodeScrollableAreaGeometry):
     25        (WebCore::AsyncScrollingCoordinator::setViewportConstraintedNodeConstraints):
     26        (WebCore::AsyncScrollingCoordinator::setScrollingNodeGeometry): Deleted.
     27        (WebCore::AsyncScrollingCoordinator::setViewportConstraintedNodeGeometry): Deleted.
     28        * page/scrolling/AsyncScrollingCoordinator.h:
     29        * page/scrolling/ScrollingCoordinator.h:
     30        (WebCore::ScrollingCoordinator::setRectRelativeToParentNode):
     31        (WebCore::ScrollingCoordinator::setScrollingNodeScrollableAreaGeometry):
     32        (WebCore::ScrollingCoordinator::setFrameScrollingNodeState):
     33        (WebCore::ScrollingCoordinator::setViewportConstraintedNodeConstraints):
     34        (WebCore::ScrollingCoordinator::setScrollingNodeGeometry): Deleted.
     35        (WebCore::ScrollingCoordinator::setViewportConstraintedNodeGeometry): Deleted.
     36        * platform/ScrollView.h:
     37        (WebCore::ScrollView::horizontalScrollbarMode const): Deleted.
     38        (WebCore::ScrollView::verticalScrollbarMode const): Deleted.
     39        * platform/ScrollableArea.cpp:
     40        (WebCore::ScrollableArea::reachableTotalContentsSize const):
     41        * platform/ScrollableArea.h:
     42        (WebCore::ScrollableArea::horizontalScrollbarMode const):
     43        (WebCore::ScrollableArea::verticalScrollbarMode const):
     44        * rendering/RenderLayer.cpp:
     45        (WebCore::RenderLayer::overhangAmount const):
     46        (WebCore::RenderLayer::reachableTotalContentsSize const):
     47        (WebCore::RenderLayer::scrollableContentsSize const): Deleted.
     48        * rendering/RenderLayer.h:
     49        * rendering/RenderLayerCompositor.cpp:
     50        (WebCore::RenderLayerCompositor::updateCompositingLayers):
     51        (WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
     52        (WebCore::RenderLayerCompositor::updateScrollingNodeForViewportConstrainedRole):
     53        (WebCore::RenderLayerCompositor::rootParentRelativeScrollableRect const):
     54        (WebCore::RenderLayerCompositor::parentRelativeScrollableRect const):
     55        (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
     56        (WebCore::RenderLayerCompositor::updateScrollingNodeForFrameHostingRole):
     57        (WebCore::RenderLayerCompositor::computeFrameScrollingGeometry const): Deleted.
     58        (WebCore::RenderLayerCompositor::computeFrameHostingGeometry const): Deleted.
     59        (WebCore::RenderLayerCompositor::computeOverflowScrollingGeometry const): Deleted.
     60        * rendering/RenderLayerCompositor.h:
     61
    1622019-03-02  Darin Adler  <darin@apple.com>
    263
  • trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp

    r241934 r242333  
    128128
    129129    setEventTrackingRegionsDirty();
     130
     131#if PLATFORM(COCOA)
    130132    if (!coordinatesScrollingForFrameView(frameView))
    131133        return;
    132134
    133     auto* node = m_scrollingStateTree->stateNodeForID(frameView.scrollingNodeID());
    134     if (!node || !is<ScrollingStateFrameScrollingNode>(*node))
    135         return;
    136 
    137     auto& frameScrollingNode = downcast<ScrollingStateFrameScrollingNode>(*node);
    138 
    139     auto* verticalScrollbar = frameView.verticalScrollbar();
    140     auto* horizontalScrollbar = frameView.horizontalScrollbar();
    141     frameScrollingNode.setScrollerImpsFromScrollbars(verticalScrollbar, horizontalScrollbar);
    142 
    143     frameScrollingNode.setFrameScaleFactor(frameView.frame().frameScaleFactor());
    144     frameScrollingNode.setHeaderHeight(frameView.headerHeight());
    145     frameScrollingNode.setFooterHeight(frameView.footerHeight());
    146     frameScrollingNode.setTopContentInset(frameView.topContentInset());
    147 
    148     frameScrollingNode.setLayoutViewport(frameView.layoutViewportRect());
    149     frameScrollingNode.setAsyncFrameOrOverflowScrollingEnabled(asyncFrameOrOverflowScrollingEnabled());
    150 
    151     frameScrollingNode.setMinLayoutViewportOrigin(frameView.minStableLayoutViewportOrigin());
    152     frameScrollingNode.setMaxLayoutViewportOrigin(frameView.maxStableLayoutViewportOrigin());
    153 
    154     frameScrollingNode.setScrollOrigin(frameView.scrollOrigin());
    155     frameScrollingNode.setScrollableAreaSize(frameView.visibleContentRect().size());
    156     frameScrollingNode.setTotalContentsSize(frameView.totalContentsSize());
    157     frameScrollingNode.setReachableContentsSize(frameView.totalContentsSize());
    158     frameScrollingNode.setFixedElementsLayoutRelativeToFrame(frameView.fixedElementsLayoutRelativeToFrame());
    159     frameScrollingNode.setScrollBehaviorForFixedElements(frameView.scrollBehaviorForFixedElements());
    160 
    161 #if ENABLE(CSS_SCROLL_SNAP)
    162     frameView.updateSnapOffsets();
    163     updateScrollSnapPropertiesWithFrameView(frameView);
    164 #endif
    165 
    166 #if PLATFORM(COCOA)
    167135    auto* page = frameView.frame().page();
    168136    if (page && page->expectsWheelEventTriggers()) {
    169137        LOG(WheelEventTestTriggers, "    AsyncScrollingCoordinator::frameViewLayoutUpdated: Expects wheel event test trigger=%d", page->expectsWheelEventTriggers());
     138
     139        auto* node = m_scrollingStateTree->stateNodeForID(frameView.scrollingNodeID());
     140        if (!is<ScrollingStateFrameScrollingNode>(node))
     141            return;
     142
     143        auto& frameScrollingNode = downcast<ScrollingStateFrameScrollingNode>(*node);
    170144        frameScrollingNode.setExpectsWheelEventTestTrigger(page->expectsWheelEventTriggers());
    171145    }
    172146#endif
    173 
    174     ScrollableAreaParameters scrollParameters;
    175     scrollParameters.horizontalScrollElasticity = frameView.horizontalScrollElasticity();
    176     scrollParameters.verticalScrollElasticity = frameView.verticalScrollElasticity();
    177     scrollParameters.hasEnabledHorizontalScrollbar = horizontalScrollbar && horizontalScrollbar->enabled();
    178     scrollParameters.hasEnabledVerticalScrollbar = verticalScrollbar && verticalScrollbar->enabled();
    179     scrollParameters.horizontalScrollbarMode = frameView.horizontalScrollbarMode();
    180     scrollParameters.verticalScrollbarMode = frameView.verticalScrollbarMode();
    181     scrollParameters.useDarkAppearanceForScrollbars = frameView.useDarkAppearanceForScrollbars();
    182 
    183     frameScrollingNode.setScrollableAreaParameters(scrollParameters);
    184147}
    185148
     
    615578}
    616579
    617 void AsyncScrollingCoordinator::setScrollingNodeGeometry(ScrollingNodeID nodeID, const ScrollingGeometry& scrollingGeometry)
     580void AsyncScrollingCoordinator::setRectRelativeToParentNode(ScrollingNodeID nodeID, const LayoutRect& parentRelativeScrollableRect)
    618581{
    619582    auto* stateNode = m_scrollingStateTree->stateNodeForID(nodeID);
     
    622585        return;
    623586
    624     if (stateNode->nodeType() == ScrollingNodeType::FrameHosting) {
     587    if (is<ScrollingStateFrameHostingNode>(*stateNode)) {
    625588        auto& frameHostingStateNode = downcast<ScrollingStateFrameHostingNode>(*stateNode);
    626         frameHostingStateNode.setParentRelativeScrollableRect(scrollingGeometry.parentRelativeScrollableRect);
    627         return;
    628     }
     589        frameHostingStateNode.setParentRelativeScrollableRect(parentRelativeScrollableRect);
     590        return;
     591    }
     592
     593    if (is<ScrollingStateScrollingNode>(stateNode)) {
     594        auto& scrollingStateNode = downcast<ScrollingStateScrollingNode>(*stateNode);
     595        scrollingStateNode.setParentRelativeScrollableRect(parentRelativeScrollableRect);
     596    }
     597}
     598
     599void AsyncScrollingCoordinator::setFrameScrollingNodeState(ScrollingNodeID nodeID, const FrameView& frameView)
     600{
     601    auto* stateNode = m_scrollingStateTree->stateNodeForID(nodeID);
     602    ASSERT(stateNode);
     603    if (!is<ScrollingStateFrameScrollingNode>(stateNode))
     604        return;
     605
     606    auto& frameScrollingNode = downcast<ScrollingStateFrameScrollingNode>(*stateNode);
     607
     608    auto* verticalScrollbar = frameView.verticalScrollbar();
     609    auto* horizontalScrollbar = frameView.horizontalScrollbar();
     610    frameScrollingNode.setScrollerImpsFromScrollbars(verticalScrollbar, horizontalScrollbar);
     611
     612    frameScrollingNode.setFrameScaleFactor(frameView.frame().frameScaleFactor());
     613    frameScrollingNode.setHeaderHeight(frameView.headerHeight());
     614    frameScrollingNode.setFooterHeight(frameView.footerHeight());
     615    frameScrollingNode.setTopContentInset(frameView.topContentInset());
     616    frameScrollingNode.setLayoutViewport(frameView.layoutViewportRect());
     617    frameScrollingNode.setAsyncFrameOrOverflowScrollingEnabled(asyncFrameOrOverflowScrollingEnabled());
     618
     619    frameScrollingNode.setMinLayoutViewportOrigin(frameView.minStableLayoutViewportOrigin());
     620    frameScrollingNode.setMaxLayoutViewportOrigin(frameView.maxStableLayoutViewportOrigin());
     621
     622    frameScrollingNode.setFixedElementsLayoutRelativeToFrame(frameView.fixedElementsLayoutRelativeToFrame());
     623    frameScrollingNode.setScrollBehaviorForFixedElements(frameView.scrollBehaviorForFixedElements());
     624}
     625
     626void AsyncScrollingCoordinator::setScrollingNodeScrollableAreaGeometry(ScrollingNodeID nodeID, ScrollableArea& scrollableArea)
     627{
     628    auto* stateNode = m_scrollingStateTree->stateNodeForID(nodeID);
     629    ASSERT(stateNode);
     630    if (!stateNode)
     631        return;
    629632
    630633    auto& scrollingNode = downcast<ScrollingStateScrollingNode>(*stateNode);
    631 
    632     scrollingNode.setParentRelativeScrollableRect(scrollingGeometry.parentRelativeScrollableRect);
    633     scrollingNode.setScrollOrigin(scrollingGeometry.scrollOrigin);
    634     scrollingNode.setScrollPosition(scrollingGeometry.scrollPosition);
    635     scrollingNode.setTotalContentsSize(scrollingGeometry.contentSize);
    636     scrollingNode.setReachableContentsSize(scrollingGeometry.reachableContentSize);
    637     scrollingNode.setScrollableAreaSize(scrollingGeometry.scrollableAreaSize);
     634    scrollingNode.setScrollOrigin(scrollableArea.scrollOrigin());
     635    scrollingNode.setScrollPosition(scrollableArea.scrollPosition());
     636    scrollingNode.setTotalContentsSize(scrollableArea.totalContentsSize());
     637    scrollingNode.setReachableContentsSize(scrollableArea.reachableTotalContentsSize());
     638    scrollingNode.setScrollableAreaSize(scrollableArea.visibleSize());
     639
     640    auto* verticalScrollbar = scrollableArea.verticalScrollbar();
     641    auto* horizontalScrollbar = scrollableArea.horizontalScrollbar();
     642
     643    ScrollableAreaParameters scrollParameters;
     644    scrollParameters.horizontalScrollElasticity = scrollableArea.horizontalScrollElasticity();
     645    scrollParameters.verticalScrollElasticity = scrollableArea.verticalScrollElasticity();
     646    scrollParameters.hasEnabledHorizontalScrollbar = horizontalScrollbar && horizontalScrollbar->enabled();
     647    scrollParameters.hasEnabledVerticalScrollbar = verticalScrollbar && verticalScrollbar->enabled();
     648    scrollParameters.horizontalScrollbarMode = scrollableArea.horizontalScrollbarMode();
     649    scrollParameters.verticalScrollbarMode = scrollableArea.verticalScrollbarMode();
     650    scrollParameters.useDarkAppearanceForScrollbars = scrollableArea.useDarkAppearanceForScrollbars();
     651
     652    scrollingNode.setScrollableAreaParameters(scrollParameters);
    638653
    639654#if ENABLE(CSS_SCROLL_SNAP)
    640     // updateScrollSnapPropertiesWithFrameView() sets these for frame scrolling nodes. FIXME: Why the difference?
    641     if (is<ScrollingStateOverflowScrollingNode>(scrollingNode)) {
    642         setStateScrollingNodeSnapOffsetsAsFloat(scrollingNode, ScrollEventAxis::Horizontal, &scrollingGeometry.horizontalSnapOffsets, &scrollingGeometry.horizontalSnapOffsetRanges, m_page->deviceScaleFactor());
    643         setStateScrollingNodeSnapOffsetsAsFloat(scrollingNode, ScrollEventAxis::Vertical, &scrollingGeometry.verticalSnapOffsets, &scrollingGeometry.verticalSnapOffsetRanges, m_page->deviceScaleFactor());
    644         scrollingNode.setCurrentHorizontalSnapPointIndex(scrollingGeometry.currentHorizontalSnapPointIndex);
    645         scrollingNode.setCurrentVerticalSnapPointIndex(scrollingGeometry.currentVerticalSnapPointIndex);
    646     }
     655    scrollableArea.updateSnapOffsets();
     656    setStateScrollingNodeSnapOffsetsAsFloat(scrollingNode, ScrollEventAxis::Horizontal, scrollableArea.horizontalSnapOffsets(), scrollableArea.horizontalSnapOffsetRanges(), m_page->deviceScaleFactor());
     657    setStateScrollingNodeSnapOffsetsAsFloat(scrollingNode, ScrollEventAxis::Vertical, scrollableArea.verticalSnapOffsets(), scrollableArea.verticalSnapOffsetRanges(), m_page->deviceScaleFactor());
     658    scrollingNode.setCurrentHorizontalSnapPointIndex(scrollableArea.currentHorizontalSnapPointIndex());
     659    scrollingNode.setCurrentVerticalSnapPointIndex(scrollableArea.currentVerticalSnapPointIndex());
    647660#endif
    648661}
    649662
    650 void AsyncScrollingCoordinator::setViewportConstraintedNodeGeometry(ScrollingNodeID nodeID, const ViewportConstraints& constraints)
     663void AsyncScrollingCoordinator::setViewportConstraintedNodeConstraints(ScrollingNodeID nodeID, const ViewportConstraints& constraints)
    651664{
    652665    auto* node = m_scrollingStateTree->stateNodeForID(nodeID);
  • trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h

    r241934 r242333  
    109109
    110110    WEBCORE_EXPORT void setNodeLayers(ScrollingNodeID, const NodeLayers&) override;
    111     WEBCORE_EXPORT void setScrollingNodeGeometry(ScrollingNodeID, const ScrollingGeometry&) override;
    112     WEBCORE_EXPORT void setViewportConstraintedNodeGeometry(ScrollingNodeID, const ViewportConstraints&) override;
     111
     112    WEBCORE_EXPORT void setRectRelativeToParentNode(ScrollingNodeID, const LayoutRect&) override;
     113    WEBCORE_EXPORT void setScrollingNodeScrollableAreaGeometry(ScrollingNodeID, ScrollableArea&) override;
     114    WEBCORE_EXPORT void setFrameScrollingNodeState(ScrollingNodeID, const FrameView&) override;
     115    WEBCORE_EXPORT void setViewportConstraintedNodeConstraints(ScrollingNodeID, const ViewportConstraints&) override;
    113116
    114117    WEBCORE_EXPORT void reconcileScrollingState(FrameView&, const FloatPoint&, const LayoutViewportOriginOrOverrideRect&, bool programmaticScroll, ViewportRectStability, ScrollingLayerPositionAction) override;
  • trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h

    r240916 r242333  
    140140    virtual void setNodeLayers(ScrollingNodeID, const NodeLayers&) { }
    141141
    142     struct ScrollingGeometry {
    143         LayoutRect parentRelativeScrollableRect;
    144         FloatSize scrollableAreaSize;
    145         FloatSize contentSize;
    146         FloatSize reachableContentSize; // Smaller than contentSize when overflow is hidden on one axis.
    147         FloatPoint scrollPosition;
    148         IntPoint scrollOrigin;
    149 #if ENABLE(CSS_SCROLL_SNAP)
    150         Vector<LayoutUnit> horizontalSnapOffsets;
    151         Vector<LayoutUnit> verticalSnapOffsets;
    152         Vector<ScrollOffsetRange<LayoutUnit>> horizontalSnapOffsetRanges;
    153         Vector<ScrollOffsetRange<LayoutUnit>> verticalSnapOffsetRanges;
    154         unsigned currentHorizontalSnapPointIndex;
    155         unsigned currentVerticalSnapPointIndex;
    156 #endif
    157     };
    158 
    159     virtual void setScrollingNodeGeometry(ScrollingNodeID, const ScrollingGeometry&) { }
    160     virtual void setViewportConstraintedNodeGeometry(ScrollingNodeID, const ViewportConstraints&) { }
     142    virtual void setRectRelativeToParentNode(ScrollingNodeID, const LayoutRect&) { }
     143    virtual void setScrollingNodeScrollableAreaGeometry(ScrollingNodeID, ScrollableArea&) { }
     144    virtual void setFrameScrollingNodeState(ScrollingNodeID, const FrameView&) { }
     145    virtual void setViewportConstraintedNodeConstraints(ScrollingNodeID, const ViewportConstraints&) { }
    161146
    162147    virtual void reconcileViewportConstrainedLayerPositions(ScrollingNodeID, const LayoutRect&, ScrollingLayerPositionAction) { }
  • trunk/Source/WebCore/platform/ScrollView.h

    r240901 r242333  
    111111    void setVerticalScrollbarMode(ScrollbarMode mode, bool lock = false) { setScrollbarModes(horizontalScrollbarMode(), mode, horizontalScrollbarLock(), lock); };
    112112    WEBCORE_EXPORT void scrollbarModes(ScrollbarMode& horizontalMode, ScrollbarMode& verticalMode) const;
    113     ScrollbarMode horizontalScrollbarMode() const { ScrollbarMode horizontal, vertical; scrollbarModes(horizontal, vertical); return horizontal; }
    114     ScrollbarMode verticalScrollbarMode() const { ScrollbarMode horizontal, vertical; scrollbarModes(horizontal, vertical); return vertical; }
     113    ScrollbarMode horizontalScrollbarMode() const final { ScrollbarMode horizontal, vertical; scrollbarModes(horizontal, vertical); return horizontal; }
     114    ScrollbarMode verticalScrollbarMode() const final { ScrollbarMode horizontal, vertical; scrollbarModes(horizontal, vertical); return vertical; }
    115115
    116116    void setHorizontalScrollbarLock(bool lock = true) { m_horizontalScrollbarLock = lock; }
  • trunk/Source/WebCore/platform/ScrollableArea.cpp

    r239689 r242333  
    670670}
    671671
     672IntSize ScrollableArea::reachableTotalContentsSize() const
     673{
     674    return totalContentsSize();
     675}
     676
    672677IntSize ScrollableArea::totalContentsSize() const
    673678{
  • trunk/Source/WebCore/platform/ScrollableArea.h

    r240891 r242333  
    108108    ScrollElasticity horizontalScrollElasticity() const { return static_cast<ScrollElasticity>(m_horizontalScrollElasticity); }
    109109
     110    virtual ScrollbarMode horizontalScrollbarMode() const { return ScrollbarAuto; }
     111    virtual ScrollbarMode verticalScrollbarMode() const { return ScrollbarAuto; }
     112
    110113    bool inLiveResize() const { return m_inLiveResize; }
    111114    WEBCORE_EXPORT virtual void willStartLiveResize();
     
    254257    // The totalContentsSize() is equivalent to the contentsSize() plus the header and footer heights.
    255258    WEBCORE_EXPORT IntSize totalContentsSize() const;
     259    WEBCORE_EXPORT virtual IntSize reachableTotalContentsSize() const;
    256260
    257261    virtual bool useDarkAppearance() const { return false; }
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r242248 r242333  
    28142814    // FIXME: use maximumScrollOffset(), or just move this to ScrollableArea.
    28152815    ScrollOffset scrollOffset = scrollOffsetFromPosition(scrollPosition());
     2816    auto reachableSize = reachableTotalContentsSize();
    28162817    if (scrollOffset.y() < 0)
    28172818        stretch.setHeight(scrollOffset.y());
    2818     else if (scrollableContentsSize().height() && scrollOffset.y() > scrollableContentsSize().height() - visibleHeight())
    2819         stretch.setHeight(scrollOffset.y() - (scrollableContentsSize().height() - visibleHeight()));
     2819    else if (reachableSize.height() && scrollOffset.y() > reachableSize.height() - visibleHeight())
     2820        stretch.setHeight(scrollOffset.y() - (reachableSize.height() - visibleHeight()));
    28202821
    28212822    if (scrollOffset.x() < 0)
    28222823        stretch.setWidth(scrollOffset.x());
    2823     else if (scrollableContentsSize().width() && scrollOffset.x() > scrollableContentsSize().width() - visibleWidth())
    2824         stretch.setWidth(scrollOffset.x() - (scrollableContentsSize().width() - visibleWidth()));
     2824    else if (reachableSize.width() && scrollOffset.x() > reachableSize.width() - visibleWidth())
     2825        stretch.setWidth(scrollOffset.x() - (reachableSize.width() - visibleWidth()));
    28252826
    28262827    return stretch;
     
    29492950}
    29502951
    2951 IntSize RenderLayer::scrollableContentsSize() const
     2952IntSize RenderLayer::reachableTotalContentsSize() const
    29522953{
    29532954    IntSize contentsSize = this->contentsSize();
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r242248 r242333  
    400400    IntSize visibleSize() const override;
    401401    IntSize contentsSize() const override;
     402    IntSize reachableTotalContentsSize() const override;
    402403
    403404    int scrollWidth() const;
     
    420421
    421422    ScrollOffset scrollOffset() const { return scrollOffsetFromPosition(m_scrollPosition); }
    422     IntSize scrollableContentsSize() const;
    423423
    424424    void availableContentSizeChanged(AvailableSizeChangeReason) override;
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r242308 r242333  
    701701    }
    702702
     703    if (updateType == CompositingUpdateType::AfterLayout) {
     704        // Ensure that post-layout updates push new scroll position and viewport rects onto the root node.
     705        rootRenderLayer().setNeedsScrollingTreeUpdate();
     706    }
     707
    703708    if (!updateRoot->hasDescendantNeedingCompositingRequirementsTraversal() && !m_compositing) {
    704709        LOG_WITH_STREAM(Compositing, stream << " no compositing work to do");
     
    11721177       
    11731178        OptionSet<ScrollingNodeChangeFlags> scrollingNodeChanges = { ScrollingNodeChangeFlags::Layer };
    1174         if (layerNeedsUpdate || layer.needsCompositingGeometryUpdate() || layer.needsScrollingTreeUpdate()) {
     1179        if (layerNeedsUpdate || layer.needsCompositingGeometryUpdate()) {
    11751180            layerBacking->updateGeometry();
    11761181            scrollingNodeChanges.add(ScrollingNodeChangeFlags::LayerGeometry);
    1177         }
     1182        } else if (layer.needsScrollingTreeUpdate())
     1183            scrollingNodeChanges.add(ScrollingNodeChangeFlags::LayerGeometry);
    11781184
    11791185        if (auto* reflection = layer.reflectionLayer()) {
     
    39233929        switch (nodeType) {
    39243930        case ScrollingNodeType::Fixed:
    3925             scrollingCoordinator->setViewportConstraintedNodeGeometry(newNodeID, computeFixedViewportConstraints(layer));
     3931            scrollingCoordinator->setViewportConstraintedNodeConstraints(newNodeID, computeFixedViewportConstraints(layer));
    39263932            break;
    39273933        case ScrollingNodeType::Sticky:
    3928             scrollingCoordinator->setViewportConstraintedNodeGeometry(newNodeID, computeStickyViewportConstraints(layer));
     3934            scrollingCoordinator->setViewportConstraintedNodeConstraints(newNodeID, computeStickyViewportConstraints(layer));
    39293935            break;
    39303936        case ScrollingNodeType::MainFrame:
     
    39393945}
    39403946
    3941 void RenderLayerCompositor::computeFrameScrollingGeometry(ScrollingCoordinator::ScrollingGeometry& scrollingGeometry) const
     3947LayoutRect RenderLayerCompositor::rootParentRelativeScrollableRect() const
    39423948{
    39433949    auto& frameView = m_renderView.frameView();
    39443950
    39453951    if (m_renderView.frame().isMainFrame())
    3946         scrollingGeometry.parentRelativeScrollableRect = frameView.frameRect();
    3947     else
    3948         scrollingGeometry.parentRelativeScrollableRect = LayoutRect({ }, LayoutSize(frameView.size()));
    3949 
    3950     scrollingGeometry.scrollOrigin = frameView.scrollOrigin();
    3951     scrollingGeometry.scrollableAreaSize = frameView.visibleContentRect().size();
    3952     scrollingGeometry.contentSize = frameView.totalContentsSize();
    3953     scrollingGeometry.reachableContentSize = frameView.totalContentsSize();
    3954 #if ENABLE(CSS_SCROLL_SNAP)
    3955     frameView.updateSnapOffsets();
    3956     updateScrollSnapPropertiesWithFrameView(frameView);
    3957 #endif
    3958 }
    3959 
    3960 void RenderLayerCompositor::computeFrameHostingGeometry(const RenderLayer& layer, const RenderLayer* ancestorLayer, ScrollingCoordinator::ScrollingGeometry& scrollingGeometry) const
     3952        return frameView.frameRect();
     3953   
     3954    return LayoutRect({ }, LayoutSize(frameView.size()));
     3955}
     3956
     3957LayoutRect RenderLayerCompositor::parentRelativeScrollableRect(const RenderLayer& layer, const RenderLayer* ancestorLayer) const
    39613958{
    39623959    // FIXME: ancestorLayer needs to be always non-null, so should become a reference.
    3963     if (ancestorLayer) {
    3964         LayoutRect scrollableRect;
    3965         if (is<RenderBox>(layer.renderer()))
    3966             scrollableRect = downcast<RenderBox>(layer.renderer()).paddingBoxRect();
    3967 
    3968         auto offset = layer.convertToLayerCoords(ancestorLayer, scrollableRect.location()); // FIXME: broken for columns.
    3969         scrollableRect.setLocation(offset);
    3970         scrollingGeometry.parentRelativeScrollableRect = scrollableRect;
    3971     }
    3972 }
    3973 
    3974 void RenderLayerCompositor::computeOverflowScrollingGeometry(const RenderLayer& layer, const RenderLayer* ancestorLayer, ScrollingCoordinator::ScrollingGeometry& scrollingGeometry) const
    3975 {
    3976     // FIXME: ancestorLayer needs to be always non-null, so should become a reference.
    3977     if (ancestorLayer) {
    3978         LayoutRect scrollableRect;
    3979         if (is<RenderBox>(layer.renderer()))
    3980             scrollableRect = downcast<RenderBox>(layer.renderer()).paddingBoxRect();
    3981 
    3982         auto offset = layer.convertToLayerCoords(ancestorLayer, scrollableRect.location()); // FIXME: broken for columns.
    3983         scrollableRect.setLocation(offset);
    3984         scrollingGeometry.parentRelativeScrollableRect = scrollableRect;
    3985     }
    3986 
    3987     scrollingGeometry.scrollOrigin = layer.scrollOrigin();
    3988     scrollingGeometry.scrollPosition = layer.scrollPosition();
    3989     scrollingGeometry.scrollableAreaSize = layer.visibleSize();
    3990     scrollingGeometry.contentSize = layer.contentsSize();
    3991     scrollingGeometry.reachableContentSize = layer.scrollableContentsSize();
    3992 #if ENABLE(CSS_SCROLL_SNAP)
    3993     if (auto* offsets = layer.horizontalSnapOffsets())
    3994         scrollingGeometry.horizontalSnapOffsets = *offsets;
    3995     if (auto* offsets = layer.verticalSnapOffsets())
    3996         scrollingGeometry.verticalSnapOffsets = *offsets;
    3997     if (auto* ranges = layer.horizontalSnapOffsetRanges())
    3998         scrollingGeometry.horizontalSnapOffsetRanges = *ranges;
    3999     if (auto* ranges = layer.verticalSnapOffsetRanges())
    4000         scrollingGeometry.verticalSnapOffsetRanges = *ranges;
    4001     scrollingGeometry.currentHorizontalSnapPointIndex = layer.currentHorizontalSnapPointIndex();
    4002     scrollingGeometry.currentVerticalSnapPointIndex = layer.currentVerticalSnapPointIndex();
    4003 #endif
     3960    if (!ancestorLayer)
     3961        return LayoutRect({ }, LayoutSize(layer.visibleSize()));
     3962
     3963    LayoutRect scrollableRect;
     3964    if (is<RenderBox>(layer.renderer()))
     3965        scrollableRect = downcast<RenderBox>(layer.renderer()).paddingBoxRect();
     3966
     3967    auto offset = layer.convertToLayerCoords(ancestorLayer, scrollableRect.location()); // FIXME: broken for columns.
     3968    scrollableRect.setLocation(offset);
     3969    return scrollableRect;
    40043970}
    40053971
     
    40253991
    40263992        if (changes & ScrollingNodeChangeFlags::LayerGeometry) {
    4027             ScrollingCoordinator::ScrollingGeometry scrollingGeometry;
    4028             computeFrameScrollingGeometry(scrollingGeometry);
    4029             scrollingCoordinator->setScrollingNodeGeometry(newNodeID, scrollingGeometry);
     3993            scrollingCoordinator->setRectRelativeToParentNode(newNodeID, rootParentRelativeScrollableRect());
     3994            scrollingCoordinator->setScrollingNodeScrollableAreaGeometry(newNodeID, frameView);
     3995            scrollingCoordinator->setFrameScrollingNodeState(newNodeID, frameView);
    40303996        }
    40313997    } else {
     
    40414007        if (changes & ScrollingNodeChangeFlags::LayerGeometry && treeState.parentNodeID) {
    40424008            RenderLayer* scrollingAncestorLayer = m_scrollingNodeToLayerMap.get(treeState.parentNodeID.value());
    4043             ScrollingCoordinator::ScrollingGeometry scrollingGeometry;
    4044             computeOverflowScrollingGeometry(layer, scrollingAncestorLayer, scrollingGeometry);
    4045             scrollingCoordinator->setScrollingNodeGeometry(newNodeID, scrollingGeometry);
     4009            scrollingCoordinator->setRectRelativeToParentNode(newNodeID, parentRelativeScrollableRect(layer, scrollingAncestorLayer));
     4010            scrollingCoordinator->setScrollingNodeScrollableAreaGeometry(newNodeID, layer);
    40464011        }
    40474012    }
     
    40654030    if (changes & ScrollingNodeChangeFlags::LayerGeometry && treeState.parentNodeID) {
    40664031        RenderLayer* scrollingAncestorLayer = m_scrollingNodeToLayerMap.get(treeState.parentNodeID.value());
    4067         ScrollingCoordinator::ScrollingGeometry scrollingGeometry;
    4068         computeFrameHostingGeometry(layer, scrollingAncestorLayer, scrollingGeometry);
    4069         scrollingCoordinator->setScrollingNodeGeometry(newNodeID, scrollingGeometry);
     4032        scrollingCoordinator->setRectRelativeToParentNode(newNodeID, parentRelativeScrollableRect(layer, scrollingAncestorLayer));
    40704033    }
    40714034
     
    42854248    bool allowVerticalScrollbar = !scrollbarHasDisplayNone(layer.verticalScrollbar());
    42864249    m_chromeClient.addOrUpdateScrollingLayer(layer.renderer().element(), backing->scrollContainerLayer()->platformLayer(), backing->scrolledContentsLayer()->platformLayer(),
    4287         layer.scrollableContentsSize(), allowHorizontalScrollbar, allowVerticalScrollbar);
     4250        layer.reachableTotalContentsSize(), allowHorizontalScrollbar, allowVerticalScrollbar);
    42884251}
    42894252
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.h

    r240916 r242333  
    499499    StickyPositionViewportConstraints computeStickyViewportConstraints(RenderLayer&) const;
    500500
    501     void computeFrameScrollingGeometry(ScrollingCoordinator::ScrollingGeometry&) const;
    502     void computeFrameHostingGeometry(const RenderLayer&, const RenderLayer* ancestorLayer, ScrollingCoordinator::ScrollingGeometry&) const;
    503     void computeOverflowScrollingGeometry(const RenderLayer&, const RenderLayer* ancestorLayer, ScrollingCoordinator::ScrollingGeometry&) const;
     501    LayoutRect rootParentRelativeScrollableRect() const;
     502    LayoutRect parentRelativeScrollableRect(const RenderLayer&, const RenderLayer* ancestorLayer) const;
    504503
    505504    bool requiresScrollLayer(RootLayerAttachment) const;
Note: See TracChangeset for help on using the changeset viewer.