⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 242132 in webkit


Ignore:
Timestamp:
Feb 27, 2019, 10:47:49 AM (7 years ago)
Author:
Simon Fraser
Message:

Have a single notion of scroll position in the scrolling tree and derive layoutViewport from it
https://bugs.webkit.org/show_bug.cgi?id=194973

Reviewed by Antti Koivisto.

This patch cleans up how the scrolling tree responds to scrolls.

First, ScrollingTreeScrollingNode::m_currentScrollPosition is "truth" for scrolling thread/
UI process scroll position.

On macOS where handleWheelEvent on the scrolling thread changes scroll position, the
bottleneck is ScrollingTreeScrollingNode::scrollTo() which sets the new scroll position,
update the visual viewport (for frame scrolls) updates the scrolledContentsLayer position,
updates related layers on this node (counter-scrolling layers etc), and then tells the
scrolling tree, which recurses through descendant nodes so they can adjust their layer
positions.

On iOS, the bottleneck is ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling(),
which does the above other than setting scrolledContentsLayer (since we're reacting to
layer state changes, not producing them).

updateLayersAfterAncestorChange() is renamed to relatedNodeScrollPositionDidChange(), and
ScrollingTree does the tree walk so classes don't have to implement
updateLayersAfterAncestorChange() just to talk children. The ScrollingTree tree walk knows
how to get the correct layoutViewport and to stop at frame boundaries (layer updates never
need to cross frame boundaries).

We preserve 'cumulativeDelta'; it's necessary for things like fixed inside overflow:scroll,
since the fixed state was computed with the "layout" scroll position, so we have to account
for the scroll delta since the last committed position. It's possible we could improve this
in future.

Source/WebCore:

  • page/scrolling/ScrollingTree.cpp:

(WebCore::ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling):
(WebCore::ScrollingTree::notifyRelatedNodesAfterScrollPositionChange):
(WebCore::ScrollingTree::notifyRelatedNodesRecursive):
(WebCore::ScrollingTree::mainFrameLayoutViewport):
(WebCore::ScrollingTree::scrollPositionChangedViaDelegatedScrolling): Deleted.

  • page/scrolling/ScrollingTree.h:
  • page/scrolling/ScrollingTreeFrameHostingNode.cpp:

(WebCore::ScrollingTreeFrameHostingNode::updateLayersAfterAncestorChange): Deleted.

  • page/scrolling/ScrollingTreeFrameHostingNode.h:
  • page/scrolling/ScrollingTreeFrameScrollingNode.cpp:

(WebCore::ScrollingTreeFrameScrollingNode::updateViewportForCurrentScrollPosition):
(WebCore::ScrollingTreeFrameScrollingNode::localToContentsPoint const):

  • page/scrolling/ScrollingTreeFrameScrollingNode.h:
  • page/scrolling/ScrollingTreeNode.cpp:

(WebCore::ScrollingTreeNode::relatedNodeScrollPositionDidChange):
(WebCore::ScrollingTreeNode::enclosingScrollingNodeIncludingSelf):

  • page/scrolling/ScrollingTreeNode.h:
  • page/scrolling/ScrollingTreeScrollingNode.cpp:

(WebCore::ScrollingTreeScrollingNode::minimumScrollPosition const):
(WebCore::ScrollingTreeScrollingNode::scrollLimitReached const):
(WebCore::ScrollingTreeScrollingNode::adjustedScrollPosition const):
(WebCore::ScrollingTreeScrollingNode::scrollBy):
(WebCore::ScrollingTreeScrollingNode::scrollTo):
(WebCore::ScrollingTreeScrollingNode::currentScrollPositionChanged):
(WebCore::ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling):
(WebCore::ScrollingTreeScrollingNode::localToContentsPoint const):
(WebCore::ScrollingTreeScrollingNode::updateLayersAfterAncestorChange): Deleted.
(WebCore::ScrollingTreeScrollingNode::setScrollPosition): Deleted.

  • page/scrolling/ScrollingTreeScrollingNode.h:
  • page/scrolling/ScrollingTreeScrollingNodeDelegate.h:

(WebCore::ScrollingTreeScrollingNodeDelegate::currentScrollPosition const):
(WebCore::ScrollingTreeScrollingNodeDelegate::scrollPosition const): Deleted.

  • page/scrolling/ThreadedScrollingTree.cpp:

(WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):

  • page/scrolling/ThreadedScrollingTree.h:
  • page/scrolling/cocoa/ScrollingTreeFixedNode.h:
  • page/scrolling/cocoa/ScrollingTreeFixedNode.mm:

(WebCore::ScrollingTreeFixedNode::relatedNodeScrollPositionDidChange):
(WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange): Deleted.

  • page/scrolling/cocoa/ScrollingTreeStickyNode.h:
  • page/scrolling/cocoa/ScrollingTreeStickyNode.mm:

(WebCore::ScrollingTreeStickyNode::relatedNodeScrollPositionDidChange):
(WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange): Deleted.

  • page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
  • page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:

(WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
(WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
(WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
(WebCore::ScrollingTreeFrameScrollingNodeMac::adjustedScrollPosition const):
(WebCore::ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged):
(WebCore::ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers):
(WebCore::ScrollingTreeFrameScrollingNodeMac::repositionRelatedLayers):
(WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinState):
(WebCore::ScrollingTreeFrameScrollingNodeMac::exposedUnfilledArea const):
(WebCore::ScrollingTreeFrameScrollingNodeMac::scrollPosition const): Deleted.
(WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition): Deleted.
(WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition): Deleted.
(WebCore::ScrollingTreeFrameScrollingNodeMac::updateLayersAfterViewportChange): Deleted.

  • page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:

(): Deleted.

  • page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:

(WebCore::ScrollingTreeOverflowScrollingNodeMac::adjustedScrollPosition const):
(WebCore::ScrollingTreeOverflowScrollingNodeMac::repositionScrollingLayers):
(WebCore::ScrollingTreeOverflowScrollingNodeMac::~ScrollingTreeOverflowScrollingNodeMac): Deleted.
(WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterAncestorChange): Deleted.
(WebCore::ScrollingTreeOverflowScrollingNodeMac::scrollPosition const): Deleted.
(WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPosition): Deleted.
(WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition): Deleted.
(WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterDelegatedScroll): Deleted.

  • page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:

(WebCore::ScrollingTreeScrollingNodeDelegateMac::isAlreadyPinnedInDirectionOfGesture):
(WebCore::ScrollingTreeScrollingNodeDelegateMac::stretchAmount):
(WebCore::ScrollingTreeScrollingNodeDelegateMac::pinnedInDirection):
(WebCore::ScrollingTreeScrollingNodeDelegateMac::adjustScrollPositionToBoundsIfNecessary):
(WebCore::ScrollingTreeScrollingNodeDelegateMac::scrollOffset const):
(WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollOnAxis):

Source/WebKit:

  • UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:

(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):

  • UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:

(WebKit::RemoteScrollingCoordinatorProxy::viewportChangedViaDelegatedScrolling):
(WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):

  • UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
  • UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:

(WebKit::RemoteScrollingTree::scrollingTreeNodeDidScroll):

  • UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
  • UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:

(WebKit::RemoteScrollingCoordinatorProxy::currentLayoutViewport const):

  • UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h:
  • UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:

(WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren):
(WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::repositionScrollingLayers):
(WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::repositionRelatedLayers):
(WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::scrollPosition const): Deleted.
(WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::setScrollPosition): Deleted.
(WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::setScrollLayerPosition): Deleted.
(WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateChildNodesAfterScroll): Deleted.
(WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterDelegatedScroll): Deleted.
(WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterViewportChange): Deleted.
(WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterAncestorChange): Deleted.

  • UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
  • UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:

(WebKit::ScrollingTreeOverflowScrollingNodeIOS::repositionScrollingLayers):
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterAncestorChange): Deleted.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::scrollPosition const): Deleted.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::setScrollLayerPosition): Deleted.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterDelegatedScroll): Deleted.

  • UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
  • UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:

(WebKit::ScrollingTreeScrollingNodeDelegateIOS::ScrollingTreeScrollingNodeDelegateIOS):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::repositionScrollingLayers):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateLayersAfterAncestorChange): Deleted.
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollPosition const): Deleted.
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::setScrollLayerPosition): Deleted.
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateChildNodesAfterScroll): Deleted.
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll const): Deleted.

  • UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm:

(WebKit::ScrollerPairMac::updateValues):
(WebKit::ScrollerPairMac::valuesForOrientation):

  • UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp:

(WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::repositionRelatedLayers):
(WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::setScrollLayerPosition): Deleted.

  • UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h:
  • UIProcess/ios/WKContentView.mm:

(-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):

Location:
trunk
Files:
53 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/fast/scrolling/ios/hit-testing-iframe-001.html

    r242130 r242132  
    3636    <p>This test passes if you see a green rectangle.</p>
    3737    <div style="position: absolute; top: 3em; width: 100px; height: 100px; background: green;">
    38       <iframe id="clickInContentBox" style="left: 0px; top: 0px;" scrolling="yes" onclick="this.style.background='red'" srcdoc="
     38      <iframe id="clickInContentBox" style="left: 0px; top: 0px; -webkit-tap-highlight-color: transparent;" scrolling="yes" onclick="this.style.background='red'" srcdoc="
    3939          <body style='margin: 0; width: 200px; height: 200px;'>
    4040              <div style='position: absolute; width: 100px; height: 100px; background: red; -webkit-tap-highlight-color: transparent;'
  • trunk/LayoutTests/fast/scrolling/ios/hit-testing-iframe-002.html

    r242130 r242132  
    3636    <p>This test passes if you see a green rectangle.</p>
    3737    <div style="position: absolute; top: 3em; width: 100px; height: 100px; background: green;">
    38       <iframe id="clickInPaddingBoxOutOfContentBox" style="left: 0px; top: 0px; background: red;" onclick="this.style.background='green'" scrolling="yes" srcdoc="
     38      <iframe id="clickInPaddingBoxOutOfContentBox" style="left: 0px; top: 0px; background: red; -webkit-tap-highlight-color: transparent;" onclick="this.style.background='green;'" scrolling="yes" srcdoc="
    3939          <body style='margin: 0; width: 200px; height: 200px'>
    4040              <div style='position: absolute; width: 100px; height: 100px; background: green; -webkit-tap-highlight-color: transparent;'
  • trunk/LayoutTests/fast/scrolling/ios/hit-testing-iframe-003.html

    r242130 r242132  
    3636    <p>This test passes if you see a green rectangle.</p>
    3737    <div style="position: absolute; top: 3em; width: 100px; height: 100px; background: green;">
    38       <iframe id="clickElementAboveFrame" style="left: 0px; top: 0px;" scrolling="yes" onclick="this.style.background='red'" srcdoc="
     38      <iframe id="clickElementAboveFrame" style="left: 0px; top: 0px; -webkit-tap-highlight-color: transparent;" scrolling="yes" onclick="this.style.background='red';" srcdoc="
    3939          <body style='margin: 0; width: 200px; height: 200px; background: green;'>
    4040              <div style='position: absolute; width: 100px; height: 100px; background: green; -webkit-tap-highlight-color: transparent;'
     
    4242          </body>" onload="runTest()">
    4343      </iframe>
    44       <div style="position: absolute; width: 50px; height: 50px; left: 25px; top: 25px; background: red" onclick="this.style.background='green';"></div>
     44      <div style="position: absolute; width: 50px; height: 50px; left: 25px; top: 25px; background: red; -webkit-tap-highlight-color: transparent" onclick="this.style.background='green';"></div>
    4545    </div>
    4646</body>
  • trunk/LayoutTests/fast/scrolling/ios/hit-testing-iframe-004.html

    r242130 r242132  
    3636    <p>This test passes if you see a green rectangle.</p>
    3737    <div style="position: absolute; top: 3em; width: 100px; height: 100px; background: green;">
    38       <iframe id="clickElementInsideFrame" style="left: 0px; top: 0px;" scrolling="yes" onclick="this.style.background='red'" srcdoc="
     38      <iframe id="clickElementInsideFrame" style="left: 0px; top: 0px; -webkit-tap-highlight-color: transparent;" scrolling="yes" onclick="this.style.background='red'" srcdoc="
    3939          <body style='margin: 0; width: 200px; height: 200px; background: green;'>
    4040              <div style='position: absolute; left: 10px; top: 10px; width: 50px; height: 50px; background: red; -webkit-tap-highlight-color: transparent;'
  • trunk/LayoutTests/fast/scrolling/ios/hit-testing-iframe-005.html

    r242130 r242132  
    3838    <p>This test passes if you see a green rectangle.</p>
    3939    <div style="position: absolute; top: 3em; width: 100px; height: 100px; background: green;">
    40       <iframe id="clickElementInsideFrameAfterProgrammaticScroll" style="left: 0px; top: 0px;" scrolling="yes" onclick="this.style.background='red'" srcdoc="
     40      <iframe id="clickElementInsideFrameAfterProgrammaticScroll" style="left: 0px; top: 0px; -webkit-tap-highlight-color: transparent;" scrolling="yes" onclick="this.style.background='red'" srcdoc="
    4141          <body style='margin: 0; width: 200px; height: 200px; background: green;'>
    4242             <div style='position: absolute; width: 75px; height: 75px; background: red;'></div>
  • trunk/LayoutTests/fast/scrolling/ios/hit-testing-iframe-006.html

    r242130 r242132  
    4646    <p>This test passes if you see a green rectangle.</p>
    4747    <div style="position: absolute; top: 3em; width: 100px; height: 100px; background: green;">
    48       <iframe id="clickElementInsideFrameAfterUserScroll" style="left: 0px; top: 0px;" scrolling="yes" onclick="this.style.background='red'" srcdoc="
     48      <iframe id="clickElementInsideFrameAfterUserScroll" style="left: 0px; top: 0px; -webkit-tap-highlight-color: transparent;" scrolling="yes" onclick="this.style.background='red'" srcdoc="
    4949          <body style='margin: 0; width: 200px; height: 200px; background: green;'>
    5050             <div style='position: absolute; width: 75px; height: 75px; background: red;'></div>
  • trunk/LayoutTests/platform/ios-wk2/TestExpectations

    r242130 r242132  
    10761076
    10771077fast/scrolling/ios/scroll-events-back-forward-after-pageshow.html [ Pass Failure ]
     1078webkit.org/b/195108 fast/scrolling/ios/hit-testing-iframe-002.html [ ImageOnlyFailure ]
    10781079
    10791080webkit.org/b/157589 fast/text-autosizing/ios/text-autosizing-after-back.html [ Pass Timeout ]
  • trunk/Source/WebCore/ChangeLog

    r242129 r242132  
     12019-02-26  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Have a single notion of scroll position in the scrolling tree and derive layoutViewport from it
     4        https://bugs.webkit.org/show_bug.cgi?id=194973
     5
     6        Reviewed by Antti Koivisto.
     7
     8        This patch cleans up how the scrolling tree responds to scrolls.
     9
     10        First, ScrollingTreeScrollingNode::m_currentScrollPosition is "truth" for scrolling thread/
     11        UI process scroll position.
     12
     13        On macOS where handleWheelEvent on the scrolling thread changes scroll position, the
     14        bottleneck is ScrollingTreeScrollingNode::scrollTo() which sets the new scroll position,
     15        update the visual viewport (for frame scrolls) updates the scrolledContentsLayer position,
     16        updates related layers on this node (counter-scrolling layers etc), and then tells the
     17        scrolling tree, which recurses through descendant nodes so they can adjust their layer
     18        positions.
     19
     20        On iOS, the bottleneck is ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling(),
     21        which does the above other than setting scrolledContentsLayer (since we're reacting to
     22        layer state changes, not producing them).
     23
     24        updateLayersAfterAncestorChange() is renamed to relatedNodeScrollPositionDidChange(), and
     25        ScrollingTree does the tree walk so classes don't have to implement
     26        updateLayersAfterAncestorChange() just to talk children. The ScrollingTree tree walk knows
     27        how to get the correct layoutViewport and to stop at frame boundaries (layer updates never
     28        need to cross frame boundaries).
     29
     30        We preserve 'cumulativeDelta'; it's necessary for things like fixed inside overflow:scroll,
     31        since the fixed state was computed with the "layout" scroll position, so we have to account
     32        for the scroll delta since the last committed position. It's possible we could improve this
     33        in future.
     34
     35        * page/scrolling/ScrollingTree.cpp:
     36        (WebCore::ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling):
     37        (WebCore::ScrollingTree::notifyRelatedNodesAfterScrollPositionChange):
     38        (WebCore::ScrollingTree::notifyRelatedNodesRecursive):
     39        (WebCore::ScrollingTree::mainFrameLayoutViewport):
     40        (WebCore::ScrollingTree::scrollPositionChangedViaDelegatedScrolling): Deleted.
     41        * page/scrolling/ScrollingTree.h:
     42        * page/scrolling/ScrollingTreeFrameHostingNode.cpp:
     43        (WebCore::ScrollingTreeFrameHostingNode::updateLayersAfterAncestorChange): Deleted.
     44        * page/scrolling/ScrollingTreeFrameHostingNode.h:
     45        * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
     46        (WebCore::ScrollingTreeFrameScrollingNode::updateViewportForCurrentScrollPosition):
     47        (WebCore::ScrollingTreeFrameScrollingNode::localToContentsPoint const):
     48        * page/scrolling/ScrollingTreeFrameScrollingNode.h:
     49        * page/scrolling/ScrollingTreeNode.cpp:
     50        (WebCore::ScrollingTreeNode::relatedNodeScrollPositionDidChange):
     51        (WebCore::ScrollingTreeNode::enclosingScrollingNodeIncludingSelf):
     52        * page/scrolling/ScrollingTreeNode.h:
     53        * page/scrolling/ScrollingTreeScrollingNode.cpp:
     54        (WebCore::ScrollingTreeScrollingNode::minimumScrollPosition const):
     55        (WebCore::ScrollingTreeScrollingNode::scrollLimitReached const):
     56        (WebCore::ScrollingTreeScrollingNode::adjustedScrollPosition const):
     57        (WebCore::ScrollingTreeScrollingNode::scrollBy):
     58        (WebCore::ScrollingTreeScrollingNode::scrollTo):
     59        (WebCore::ScrollingTreeScrollingNode::currentScrollPositionChanged):
     60        (WebCore::ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling):
     61        (WebCore::ScrollingTreeScrollingNode::localToContentsPoint const):
     62        (WebCore::ScrollingTreeScrollingNode::updateLayersAfterAncestorChange): Deleted.
     63        (WebCore::ScrollingTreeScrollingNode::setScrollPosition): Deleted.
     64        * page/scrolling/ScrollingTreeScrollingNode.h:
     65        * page/scrolling/ScrollingTreeScrollingNodeDelegate.h:
     66        (WebCore::ScrollingTreeScrollingNodeDelegate::currentScrollPosition const):
     67        (WebCore::ScrollingTreeScrollingNodeDelegate::scrollPosition const): Deleted.
     68        * page/scrolling/ThreadedScrollingTree.cpp:
     69        (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):
     70        * page/scrolling/ThreadedScrollingTree.h:
     71        * page/scrolling/cocoa/ScrollingTreeFixedNode.h:
     72        * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
     73        (WebCore::ScrollingTreeFixedNode::relatedNodeScrollPositionDidChange):
     74        (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange): Deleted.
     75        * page/scrolling/cocoa/ScrollingTreeStickyNode.h:
     76        * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
     77        (WebCore::ScrollingTreeStickyNode::relatedNodeScrollPositionDidChange):
     78        (WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange): Deleted.
     79        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
     80        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
     81        (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
     82        (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
     83        (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
     84        (WebCore::ScrollingTreeFrameScrollingNodeMac::adjustedScrollPosition const):
     85        (WebCore::ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged):
     86        (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers):
     87        (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionRelatedLayers):
     88        (WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinState):
     89        (WebCore::ScrollingTreeFrameScrollingNodeMac::exposedUnfilledArea const):
     90        (WebCore::ScrollingTreeFrameScrollingNodeMac::scrollPosition const): Deleted.
     91        (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition): Deleted.
     92        (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition): Deleted.
     93        (WebCore::ScrollingTreeFrameScrollingNodeMac::updateLayersAfterViewportChange): Deleted.
     94        * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
     95        (): Deleted.
     96        * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
     97        (WebCore::ScrollingTreeOverflowScrollingNodeMac::adjustedScrollPosition const):
     98        (WebCore::ScrollingTreeOverflowScrollingNodeMac::repositionScrollingLayers):
     99        (WebCore::ScrollingTreeOverflowScrollingNodeMac::~ScrollingTreeOverflowScrollingNodeMac): Deleted.
     100        (WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterAncestorChange): Deleted.
     101        (WebCore::ScrollingTreeOverflowScrollingNodeMac::scrollPosition const): Deleted.
     102        (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPosition): Deleted.
     103        (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition): Deleted.
     104        (WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterDelegatedScroll): Deleted.
     105        * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
     106        (WebCore::ScrollingTreeScrollingNodeDelegateMac::isAlreadyPinnedInDirectionOfGesture):
     107        (WebCore::ScrollingTreeScrollingNodeDelegateMac::stretchAmount):
     108        (WebCore::ScrollingTreeScrollingNodeDelegateMac::pinnedInDirection):
     109        (WebCore::ScrollingTreeScrollingNodeDelegateMac::adjustScrollPositionToBoundsIfNecessary):
     110        (WebCore::ScrollingTreeScrollingNodeDelegateMac::scrollOffset const):
     111        (WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollOnAxis):
     112
     1132019-02-22  Simon Fraser  <simon.fraser@apple.com>
     114
     115        Have a single notion of scroll position in the scrolling tree and derive layoutViewport from it
     116        https://bugs.webkit.org/show_bug.cgi?id=194973
     117
     118        Reviewed by Antti Koivisto.
     119
     120        The "master" value for the scroll position of a ScrollingTreeScrollingNode is now its m_scrollPosition member;
     121        layout viewports and layer positions will be set from this. This allows scrollPosition() to no longer be virtual
     122        and require different code for each scrolling node subclass, and adds a choke point that we can use to update
     123        the layout viewport.
     124       
     125        We can remove m_probableMainThreadScrollPosition on ScrollingTreeFrameScrollingNodeMac because this was really just
     126        an alias for the scroll position.
     127
     128        Add some isRootNode() checks for things that should only affect the main frame.
     129
     130        * page/scrolling/ScrollingTree.h: Remove fixedPositionRect() which was unused, and is a per-frame thing so makes
     131        no sense here.
     132        * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
     133        (WebCore::ScrollingTreeFrameScrollingNode::didChangeScrollPosition):
     134        * page/scrolling/ScrollingTreeFrameScrollingNode.h:
     135        (WebCore::ScrollingTreeFrameScrollingNode::layoutViewport const):
     136        (WebCore::ScrollingTreeFrameScrollingNode::setLayoutViewport):
     137        (WebCore::ScrollingTreeFrameScrollingNode::fixedPositionRect): Deleted.
     138        * page/scrolling/ScrollingTreeScrollingNode.cpp:
     139        (WebCore::ScrollingTreeScrollingNode::setScrollPosition):
     140        (WebCore::ScrollingTreeScrollingNode::setScrollPositionInternal):
     141        (WebCore::ScrollingTreeScrollingNode::didChangeScrollPosition):
     142        * page/scrolling/ScrollingTreeScrollingNode.h:
     143        (WebCore::ScrollingTreeScrollingNode::scrollPosition const):
     144        * page/scrolling/ios/ScrollingTreeIOS.cpp:
     145        (WebCore::ScrollingTreeIOS::fixedPositionRect): Deleted.
     146        * page/scrolling/ios/ScrollingTreeIOS.h:
     147        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
     148        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
     149        (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
     150        (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
     151        (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
     152        (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition):
     153        (WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinState):
     154        (WebCore::ScrollingTreeFrameScrollingNodeMac::scrollPosition const): Deleted.
     155        * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
     156        * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
     157        (WebCore::ScrollingTreeOverflowScrollingNodeMac::scrollPosition const): Deleted.
     158
    11592019-02-27  Ulrich Pflueger  <up@nanocosmos.de>
    2160
  • trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp

    r242031 r242132  
    3636#include "ScrollingTreeFrameScrollingNode.h"
    3737#include "ScrollingTreeNode.h"
     38#include "ScrollingTreeOverflowScrollingNode.h"
    3839#include "ScrollingTreeScrollingNode.h"
    3940#include <wtf/SetForScope.h>
     
    123124}
    124125
    125 void ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling(const FloatRect& layoutViewport, double scale)
     126void ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling(const FloatPoint& scrollPosition, const FloatRect& layoutViewport, double)
    126127{
    127128    LOG_WITH_STREAM(Scrolling, stream << "ScrollingTree::viewportChangedViaDelegatedScrolling - layoutViewport " << layoutViewport);
    128129   
    129     if (m_rootNode) {
    130         auto& frameScrollingNode = downcast<ScrollingTreeFrameScrollingNode>(*m_rootNode);
    131         frameScrollingNode.setLayoutViewport(layoutViewport);
    132         frameScrollingNode.updateLayersAfterViewportChange(layoutViewport, scale);
    133     }
    134 }
    135 
    136 void ScrollingTree::scrollPositionChangedViaDelegatedScrolling(ScrollingNodeID nodeID, const WebCore::FloatPoint& scrollPosition, bool inUserInteraction)
    137 {
    138     auto* node = nodeForID(nodeID);
    139     if (!is<ScrollingTreeScrollingNode>(node))
     130    if (!m_rootNode)
    140131        return;
    141132
    142     // Update descendant nodes
    143     downcast<ScrollingTreeScrollingNode>(*node).updateLayersAfterDelegatedScroll(scrollPosition);
    144 
    145     // Update GraphicsLayers and scroll state.
    146     scrollingTreeNodeDidScroll(nodeID, scrollPosition, WTF::nullopt, inUserInteraction ? ScrollingLayerPositionAction::Sync : ScrollingLayerPositionAction::Set);
     133    auto& frameScrollingNode = downcast<ScrollingTreeFrameScrollingNode>(*m_rootNode);
     134    frameScrollingNode.wasScrolledByDelegatedScrolling(scrollPosition, layoutViewport);
    147135}
    148136
     
    262250}
    263251
     252void ScrollingTree::notifyRelatedNodesAfterScrollPositionChange(ScrollingTreeScrollingNode& changedNode)
     253{
     254    FloatSize deltaFromLastCommittedScrollPosition;
     255    FloatRect currentFrameLayoutViewport;
     256    if (is<ScrollingTreeFrameScrollingNode>(changedNode))
     257        currentFrameLayoutViewport = downcast<ScrollingTreeFrameScrollingNode>(changedNode).layoutViewport();
     258    else if (is<ScrollingTreeOverflowScrollingNode>(changedNode)) {
     259        deltaFromLastCommittedScrollPosition = changedNode.lastCommittedScrollPosition() - changedNode.currentScrollPosition();
     260
     261        if (auto* frameScrollingNode = changedNode.enclosingFrameNodeIncludingSelf())
     262            currentFrameLayoutViewport = frameScrollingNode->layoutViewport();
     263    }
     264
     265    notifyRelatedNodesRecursive(changedNode, changedNode, currentFrameLayoutViewport, deltaFromLastCommittedScrollPosition);
     266}
     267
     268void ScrollingTree::notifyRelatedNodesRecursive(ScrollingTreeScrollingNode& changedNode, ScrollingTreeNode& currNode, const FloatRect& layoutViewport, FloatSize& cumulativeDelta)
     269{
     270    currNode.relatedNodeScrollPositionDidChange(changedNode, layoutViewport, cumulativeDelta);
     271
     272    if (!currNode.children())
     273        return;
     274   
     275    auto deltaForChildren = cumulativeDelta;
     276    for (auto& child : *currNode.children()) {
     277        // Never need to cross frame boundaries, since scroll layer adjustments are isolated to each document.
     278        if (is<ScrollingTreeFrameScrollingNode>(child))
     279            continue;
     280
     281        notifyRelatedNodesRecursive(changedNode, *child, layoutViewport, deltaForChildren);
     282    }
     283}
     284
    264285void ScrollingTree::setAsyncFrameOrOverflowScrollingEnabled(bool enabled)
    265286{
     
    282303    LockHolder lock(m_mutex);
    283304    return m_mainFrameScrollPosition;
     305}
     306
     307FloatRect ScrollingTree::mainFrameLayoutViewport()
     308{
     309    if (!m_rootNode)
     310        return { };
     311
     312    auto& frameScrollingNode = downcast<ScrollingTreeFrameScrollingNode>(*m_rootNode);
     313    return frameScrollingNode.layoutViewport();
    284314}
    285315
  • trunk/Source/WebCore/page/scrolling/ScrollingTree.h

    r242031 r242132  
    7676    // Called after a scrolling tree node has handled a scroll and updated its layers.
    7777    // Updates FrameView/RenderLayer scrolling state and GraphicsLayers.
    78     virtual void scrollingTreeNodeDidScroll(ScrollingNodeID, const FloatPoint& scrollPosition, const Optional<FloatPoint>& layoutViewportOrigin, ScrollingLayerPositionAction = ScrollingLayerPositionAction::Sync) = 0;
     78    virtual void scrollingTreeNodeDidScroll(ScrollingTreeScrollingNode&, ScrollingLayerPositionAction = ScrollingLayerPositionAction::Sync) = 0;
    7979
    8080    // Called for requested scroll position updates.
     
    8383    // Delegated scrolling/zooming has caused the viewport to change, so update viewport-constrained layers
    8484    // (but don't cause scroll events to be fired).
    85     WEBCORE_EXPORT virtual void mainFrameViewportChangedViaDelegatedScrolling(const WebCore::FloatRect& layoutViewport, double scale);
    86 
    87     // Delegated scrolling has scrolled a node. Update layer positions on descendant tree nodes,
    88     // and call scrollingTreeNodeDidScroll().
    89     WEBCORE_EXPORT virtual void scrollPositionChangedViaDelegatedScrolling(ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, bool inUserInteraction);
     85    WEBCORE_EXPORT virtual void mainFrameViewportChangedViaDelegatedScrolling(const FloatPoint& scrollPosition, const WebCore::FloatRect& layoutViewport, double scale);
     86
     87    void notifyRelatedNodesAfterScrollPositionChange(ScrollingTreeScrollingNode& changedNode);
    9088
    9189    virtual void reportSynchronousScrollingReasonsChanged(MonotonicTime, SynchronousScrollingReasons) { }
     
    9391
    9492    FloatPoint mainFrameScrollPosition();
    95    
     93    WEBCORE_EXPORT virtual FloatRect mainFrameLayoutViewport();
     94
    9695#if PLATFORM(IOS_FAMILY)
    9796    virtual void scrollingTreeNodeWillStartPanGesture() { }
     
    162161
    163162    ScrollingTreeNode* nodeForID(ScrollingNodeID) const;
     163
     164    void notifyRelatedNodesRecursive(ScrollingTreeScrollingNode& changedNode, ScrollingTreeNode& currNode, const FloatRect& layoutViewport, FloatSize& cumulativeDelta);
    164165
    165166    RefPtr<ScrollingTreeNode> m_rootNode;
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameHostingNode.cpp

    r242031 r242132  
    5858}
    5959
    60 void ScrollingTreeFrameHostingNode::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta)
    61 {
    62     if (!m_children)
    63         return;
    64 
    65     for (auto& child : *m_children)
    66         child->updateLayersAfterAncestorChange(changedNode, layoutViewport, cumulativeDelta);
    67 }
    68 
    6960LayoutPoint ScrollingTreeFrameHostingNode::parentToLocalPoint(LayoutPoint point) const
    7061{
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameHostingNode.h

    r242031 r242132  
    4343
    4444    void commitStateBeforeChildren(const ScrollingStateNode&) final;
    45     void updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta) final;
    4645
    4746    const LayoutRect& parentRelativeScrollableRect() const { return m_parentRelativeScrollableRect; }
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.cpp

    r241984 r242132  
    104104}
    105105
     106void ScrollingTreeFrameScrollingNode::updateViewportForCurrentScrollPosition(Optional<FloatRect> overrideLayoutViewport)
     107{
     108    if (overrideLayoutViewport)
     109        setLayoutViewport(overrideLayoutViewport.value());
     110    else
     111        setLayoutViewport(layoutViewportForScrollPosition(currentScrollPosition(), frameScaleFactor()));
     112}
     113
    106114FloatSize ScrollingTreeFrameScrollingNode::viewToContentsOffset(const FloatPoint& scrollPosition) const
    107115{
     
    116124LayoutPoint ScrollingTreeFrameScrollingNode::localToContentsPoint(LayoutPoint point) const
    117125{
    118     auto scrolledPoint = point + LayoutPoint(scrollPosition());
     126    auto scrolledPoint = point + LayoutPoint(currentScrollPosition());
    119127    return scrolledPoint.scaled(1 / frameScaleFactor());
    120128}
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.h

    r242031 r242132  
    4242    void commitStateBeforeChildren(const ScrollingStateNode&) override;
    4343   
    44     // FIXME: We should implement this when we support ScrollingTreeScrollingNodes as children.
    45     void updateLayersAfterAncestorChange(const ScrollingTreeNode& /*changedNode*/, const FloatRect& /*layoutViewport*/, const FloatSize& /*cumulativeDelta*/) override { }
    46 
    47     void updateLayersAfterViewportChange(const FloatRect& layoutViewport, double scale) override = 0;
    48     void updateLayersAfterDelegatedScroll(const FloatPoint&) override { }
    49 
    5044    SynchronousScrollingReasons synchronousScrollingReasons() const { return m_synchronousScrollingReasons; }
    5145    bool shouldUpdateScrollLayerPositionSynchronously() const { return m_synchronousScrollingReasons; }
     
    7670    LayoutPoint localToContentsPoint(LayoutPoint) const final;
    7771
     72    WEBCORE_EXPORT void updateViewportForCurrentScrollPosition(Optional<FloatRect>) override;
     73
    7874    void dumpProperties(WTF::TextStream&, ScrollingStateTreeAsTextBehavior) const override;
    7975
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp

    r240825 r242132  
    7878}
    7979
     80void ScrollingTreeNode::relatedNodeScrollPositionDidChange(const ScrollingTreeScrollingNode&, const FloatRect&, FloatSize&)
     81{
     82}
     83
    8084void ScrollingTreeNode::dumpProperties(TextStream& ts, ScrollingStateTreeAsTextBehavior behavior) const
    8185{
     
    9195
    9296    return downcast<ScrollingTreeFrameScrollingNode>(node);
     97}
     98
     99ScrollingTreeScrollingNode* ScrollingTreeNode::enclosingScrollingNodeIncludingSelf()
     100{
     101    auto* node = this;
     102    while (node && !node->isScrollingNode())
     103        node = node->parent();
     104
     105    return downcast<ScrollingTreeScrollingNode>(node);
    93106}
    94107
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.h

    r242031 r242132  
    4343
    4444class ScrollingTreeNode : public RefCounted<ScrollingTreeNode> {
     45    friend class ScrollingTree;
    4546public:
    4647    virtual ~ScrollingTreeNode();
     
    5960    virtual void commitStateAfterChildren(const ScrollingStateNode&) { }
    6061
    61     virtual void updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta) = 0;
    62 
    6362    ScrollingTreeNode* parent() const { return m_parent; }
    6463    void setParent(ScrollingTreeNode* parent) { m_parent = parent; }
     
    7372
    7473    WEBCORE_EXPORT ScrollingTreeFrameScrollingNode* enclosingFrameNodeIncludingSelf();
     74    WEBCORE_EXPORT ScrollingTreeScrollingNode* enclosingScrollingNodeIncludingSelf();
    7575
    7676    WEBCORE_EXPORT void dump(WTF::TextStream&, ScrollingStateTreeAsTextBehavior) const;
     
    8484    ScrollingTree& scrollingTree() const { return m_scrollingTree; }
    8585
    86     std::unique_ptr<Vector<RefPtr<ScrollingTreeNode>>> m_children;
     86    WEBCORE_EXPORT virtual void relatedNodeScrollPositionDidChange(const ScrollingTreeScrollingNode& changedNode, const FloatRect& layoutViewport, FloatSize& cumulativeDelta);
    8787
    8888    WEBCORE_EXPORT virtual void dumpProperties(WTF::TextStream&, ScrollingStateTreeAsTextBehavior) const;
     89
     90    std::unique_ptr<Vector<RefPtr<ScrollingTreeNode>>> m_children;
    8991
    9092private:
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp

    r242031 r242132  
    114114}
    115115
    116 void ScrollingTreeScrollingNode::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta)
    117 {
    118     if (!m_children)
    119         return;
    120 
    121     for (auto& child : *m_children)
    122         child->updateLayersAfterAncestorChange(changedNode, layoutViewport, cumulativeDelta);
    123 }
    124 
    125116ScrollingEventResult ScrollingTreeScrollingNode::handleWheelEvent(const PlatformWheelEvent&)
    126117{
     
    128119}
    129120
    130 void ScrollingTreeScrollingNode::setScrollPosition(const FloatPoint& scrollPosition, ScrollPositionClamp clamp)
    131 {
    132     FloatPoint newScrollPosition = scrollPosition;
    133     if (clamp == ScrollPositionClamp::ToContentEdges)
    134         newScrollPosition = clampScrollPosition(scrollPosition);
    135 
    136     setScrollLayerPosition(scrollPosition, { });
    137     scrollingTree().scrollingTreeNodeDidScroll(scrollingNodeID(), scrollPosition, WTF::nullopt);
    138 }
    139 
    140121FloatPoint ScrollingTreeScrollingNode::clampScrollPosition(const FloatPoint& scrollPosition) const
    141122{
     
    145126FloatPoint ScrollingTreeScrollingNode::minimumScrollPosition() const
    146127{
    147     return FloatPoint();
     128    return { };
    148129}
    149130
     
    156137bool ScrollingTreeScrollingNode::scrollLimitReached(const PlatformWheelEvent& wheelEvent) const
    157138{
    158     FloatPoint oldScrollPosition = scrollPosition();
     139    FloatPoint oldScrollPosition = currentScrollPosition();
    159140    FloatPoint newScrollPosition = oldScrollPosition + FloatSize(wheelEvent.deltaX(), -wheelEvent.deltaY());
    160141    newScrollPosition = newScrollPosition.constrainedBetween(minimumScrollPosition(), maximumScrollPosition());
     
    162143}
    163144
     145FloatPoint ScrollingTreeScrollingNode::adjustedScrollPosition(const FloatPoint& scrollPosition, ScrollPositionClamp clamp) const
     146{
     147    if (clamp == ScrollPositionClamp::ToContentEdges)
     148        return clampScrollPosition(scrollPosition);
     149
     150    return scrollPosition;
     151}
     152
    164153void ScrollingTreeScrollingNode::scrollBy(const FloatSize& delta, ScrollPositionClamp clamp)
    165154{
    166     setScrollPosition(scrollPosition() + delta, clamp);
     155    scrollTo(currentScrollPosition() + delta, clamp);
     156}
     157
     158void ScrollingTreeScrollingNode::scrollTo(const FloatPoint& position, ScrollPositionClamp clamp)
     159{
     160    if (position == m_currentScrollPosition)
     161        return;
     162
     163    m_currentScrollPosition = adjustedScrollPosition(position, clamp);
     164    updateViewportForCurrentScrollPosition();
     165    currentScrollPositionChanged();
     166}
     167
     168void ScrollingTreeScrollingNode::currentScrollPositionChanged()
     169{
     170    repositionScrollingLayers();
     171    repositionRelatedLayers();
     172
     173    scrollingTree().notifyRelatedNodesAfterScrollPositionChange(*this);
     174    scrollingTree().scrollingTreeNodeDidScroll(*this);
     175}
     176
     177void ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling(const FloatPoint& position, Optional<FloatRect> overrideLayoutViewport)
     178{
     179    if (position == m_currentScrollPosition)
     180        return;
     181
     182    m_currentScrollPosition = adjustedScrollPosition(position, ScrollPositionClamp::None);
     183    updateViewportForCurrentScrollPosition(overrideLayoutViewport);
     184
     185    repositionRelatedLayers();
     186
     187    scrollingTree().notifyRelatedNodesAfterScrollPositionChange(*this);
     188    scrollingTree().scrollingTreeNodeDidScroll(*this);
    167189}
    168190
     
    174196LayoutPoint ScrollingTreeScrollingNode::localToContentsPoint(LayoutPoint point) const
    175197{
    176     return point + LayoutPoint(scrollPosition());
     198    return point + LayoutPoint(currentScrollPosition());
    177199}
    178200
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h

    r242031 r242132  
    4444    friend class ScrollingTreeScrollingNodeDelegateMac;
    4545#endif
     46    friend class ScrollingTree;
    4647
    4748public:
     
    5152    void commitStateAfterChildren(const ScrollingStateNode&) override;
    5253
    53     void updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta) override;
     54    virtual ScrollingEventResult handleWheelEvent(const PlatformWheelEvent&);
    5455
    55     virtual ScrollingEventResult handleWheelEvent(const PlatformWheelEvent&);
    56     virtual void setScrollPosition(const FloatPoint&, ScrollPositionClamp = ScrollPositionClamp::ToContentEdges);
     56    FloatPoint currentScrollPosition() const { return m_currentScrollPosition; }
     57    FloatPoint lastCommittedScrollPosition() const { return m_lastCommittedScrollPosition; }
    5758
     59    // These are imperative; they adjust the scrolling layers.
     60    void scrollTo(const FloatPoint&, ScrollPositionClamp = ScrollPositionClamp::ToContentEdges);
    5861    void scrollBy(const FloatSize&, ScrollPositionClamp = ScrollPositionClamp::ToContentEdges);
    5962
    60     virtual void updateLayersAfterViewportChange(const FloatRect& layoutViewport, double scale) = 0;
    61     virtual void updateLayersAfterDelegatedScroll(const FloatPoint&) { }
    62 
    63     virtual FloatPoint scrollPosition() const = 0;
     63    void wasScrolledByDelegatedScrolling(const FloatPoint& position, Optional<FloatRect> overrideLayoutViewport = { });
     64   
    6465    const FloatSize& scrollableAreaSize() const { return m_scrollableAreaSize; }
    6566    const FloatSize& totalContentsSize() const { return m_totalContentsSize; }
     
    8889
    8990    FloatPoint clampScrollPosition(const FloatPoint&) const;
     91   
     92    virtual FloatPoint adjustedScrollPosition(const FloatPoint&, ScrollPositionClamp = ScrollPositionClamp::ToContentEdges) const;
    9093
    91     virtual void setScrollLayerPosition(const FloatPoint&, const FloatRect& layoutViewport) = 0;
     94    virtual void currentScrollPositionChanged();
     95    WEBCORE_EXPORT virtual void updateViewportForCurrentScrollPosition(Optional<FloatRect> = { }) { }
    9296
    93     FloatPoint lastCommittedScrollPosition() const { return m_lastCommittedScrollPosition; }
     97    WEBCORE_EXPORT virtual void repositionScrollingLayers() { }
     98    WEBCORE_EXPORT virtual void repositionRelatedLayers() { }
     99
    94100    const FloatSize& reachableContentsSize() const { return m_reachableContentsSize; }
    95101    const LayoutRect& parentRelativeScrollableRect() const { return m_parentRelativeScrollableRect; }
     
    129135    FloatPoint m_lastCommittedScrollPosition;
    130136    LayoutRect m_parentRelativeScrollableRect;
     137    FloatPoint m_currentScrollPosition;
    131138    IntPoint m_scrollOrigin;
    132139#if ENABLE(CSS_SCROLL_SNAP)
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNodeDelegate.h

    r240825 r242132  
    4747    WEBCORE_EXPORT const IntPoint& scrollOrigin() const;
    4848
    49     FloatPoint scrollPosition() const { return m_scrollingNode.scrollPosition(); }
     49    FloatPoint currentScrollPosition() const { return m_scrollingNode.currentScrollPosition(); }
    5050    FloatPoint minimumScrollPosition() const { return m_scrollingNode.minimumScrollPosition(); }
    5151    FloatPoint maximumScrollPosition() const { return m_scrollingNode.maximumScrollPosition(); }
  • trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp

    r240787 r242132  
    3232#include "PlatformWheelEvent.h"
    3333#include "ScrollingThread.h"
     34#include "ScrollingTreeFrameScrollingNode.h"
    3435#include "ScrollingTreeNode.h"
    3536#include "ScrollingTreeScrollingNode.h"
     
    9192}
    9293
    93 void ThreadedScrollingTree::scrollingTreeNodeDidScroll(ScrollingNodeID nodeID, const FloatPoint& scrollPosition, const Optional<FloatPoint>& layoutViewportOrigin, ScrollingLayerPositionAction scrollingLayerPositionAction)
     94void ThreadedScrollingTree::scrollingTreeNodeDidScroll(ScrollingTreeScrollingNode& node, ScrollingLayerPositionAction scrollingLayerPositionAction)
    9495{
    9596    if (!m_scrollingCoordinator)
    9697        return;
    9798
    98     if (nodeID == rootNode()->scrollingNodeID())
     99    auto scrollPosition = node.currentScrollPosition();
     100
     101    if (node.isRootNode())
    99102        setMainFrameScrollPosition(scrollPosition);
    100103
    101     RunLoop::main().dispatch([scrollingCoordinator = m_scrollingCoordinator, nodeID, scrollPosition, layoutViewportOrigin, localIsHandlingProgrammaticScroll = isHandlingProgrammaticScroll(), scrollingLayerPositionAction] {
     104    Optional<FloatPoint> layoutViewportOrigin;
     105    if (is<ScrollingTreeFrameScrollingNode>(node))
     106        layoutViewportOrigin = downcast<ScrollingTreeFrameScrollingNode>(node).layoutViewport().location();
     107
     108    RunLoop::main().dispatch([scrollingCoordinator = m_scrollingCoordinator, nodeID = node.scrollingNodeID(), scrollPosition, layoutViewportOrigin, localIsHandlingProgrammaticScroll = isHandlingProgrammaticScroll(), scrollingLayerPositionAction] {
    102109        scrollingCoordinator->scheduleUpdateScrollPositionAfterAsyncScroll(nodeID, scrollPosition, layoutViewportOrigin, localIsHandlingProgrammaticScroll, scrollingLayerPositionAction);
    103110    });
  • trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h

    r240787 r242132  
    5858    explicit ThreadedScrollingTree(AsyncScrollingCoordinator&);
    5959
    60     void scrollingTreeNodeDidScroll(ScrollingNodeID, const FloatPoint& scrollPosition, const Optional<FloatPoint>& layoutViewportOrigin, ScrollingLayerPositionAction = ScrollingLayerPositionAction::Sync) override;
     60    void scrollingTreeNodeDidScroll(ScrollingTreeScrollingNode&, ScrollingLayerPositionAction = ScrollingLayerPositionAction::Sync) override;
    6161#if PLATFORM(MAC)
    6262    void handleWheelEventPhase(PlatformWheelEventPhase) override;
  • trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeFixedNode.h

    r242031 r242132  
    4848
    4949    void commitStateBeforeChildren(const ScrollingStateNode&) override;
    50     void updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta) override;
     50    void relatedNodeScrollPositionDidChange(const ScrollingTreeScrollingNode& changedNode, const FloatRect& layoutViewport, FloatSize& cumulativeDelta) override;
    5151
    5252    void dumpProperties(WTF::TextStream&, ScrollingStateTreeAsTextBehavior) const override;
  • trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeFixedNode.mm

    r242031 r242132  
    7171}
    7272
    73 void ScrollingTreeFixedNode::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta)
     73void ScrollingTreeFixedNode::relatedNodeScrollPositionDidChange(const ScrollingTreeScrollingNode&, const FloatRect& layoutViewport, FloatSize& cumulativeDelta)
    7474{
    7575    using namespace ScrollingTreeFixedNodeInternal;
    7676    FloatPoint layerPosition = m_constraints.layerPositionForViewportRect(layoutViewport);
    7777
    78     LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeFixedNode " << scrollingNodeID() << " updateLayersAfterAncestorChange: new viewport " << layoutViewport << " viewportRectAtLastLayout " << m_constraints.viewportRectAtLastLayout() << " last layer pos " << m_constraints.layerPositionAtLastLayout() << " new offset from top " << (layoutViewport.y() - layerPosition.y()));
     78    LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeFixedNode " << scrollingNodeID() << " relatedNodeScrollPositionDidChange: new viewport " << layoutViewport << " viewportRectAtLastLayout " << m_constraints.viewportRectAtLastLayout() << " last layer pos " << m_constraints.layerPositionAtLastLayout() << " new offset from top " << (layoutViewport.y() - layerPosition.y()));
    7979
    8080    layerPosition -= cumulativeDelta;
     
    9393
    9494    [m_layer setPosition:newPosition];
    95 
    96     if (!m_children)
    97         return;
    98 
    99     FloatSize newDelta = layerPosition - m_constraints.layerPositionAtLastLayout() + cumulativeDelta;
    100 
    101     for (auto& child : *m_children)
    102         child->updateLayersAfterAncestorChange(changedNode, layoutViewport, newDelta);
     95    cumulativeDelta += layerPosition - m_constraints.layerPositionAtLastLayout();
    10396}
    10497
  • trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNode.h

    r242031 r242132  
    4848
    4949    void commitStateBeforeChildren(const ScrollingStateNode&) override;
    50     void updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta) override;
     50    void relatedNodeScrollPositionDidChange(const ScrollingTreeScrollingNode& changedNode, const FloatRect& layoutViewport, FloatSize& cumulativeDelta) override;
    5151
    5252    void dumpProperties(WTF::TextStream&, ScrollingStateTreeAsTextBehavior) const override;
  • trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNode.mm

    r242031 r242132  
    7373}
    7474
    75 void ScrollingTreeStickyNode::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta)
     75void ScrollingTreeStickyNode::relatedNodeScrollPositionDidChange(const ScrollingTreeScrollingNode&, const FloatRect& layoutViewport, FloatSize& cumulativeDelta)
    7676{
    7777    using namespace ScrollingTreeStickyNodeInternal;
    78     bool adjustStickyLayer = false;
    7978    FloatRect constrainingRect;
    8079
    81     if (is<ScrollingTreeOverflowScrollingNode>(*parent())) {
    82         constrainingRect = FloatRect(downcast<ScrollingTreeOverflowScrollingNode>(*parent()).scrollPosition(), m_constraints.constrainingRectAtLastLayout().size());
    83         adjustStickyLayer = true;
    84     } else if (is<ScrollingTreeFrameScrollingNode>(*parent())) {
     80    auto* enclosingScrollingNode = enclosingScrollingNodeIncludingSelf();
     81    if (is<ScrollingTreeOverflowScrollingNode>(enclosingScrollingNode))
     82        constrainingRect = FloatRect(downcast<ScrollingTreeOverflowScrollingNode>(*enclosingScrollingNode).currentScrollPosition(), m_constraints.constrainingRectAtLastLayout().size());
     83    else if (is<ScrollingTreeFrameScrollingNode>(enclosingScrollingNode))
    8584        constrainingRect = layoutViewport;
    86         adjustStickyLayer = true;
    87     }
    88 
    89     LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeStickyNode " << scrollingNodeID() << " updateLayersAfterAncestorChange: new viewport " << layoutViewport << " constrainingRectAtLastLayout " << m_constraints.constrainingRectAtLastLayout() << " last layer pos " << m_constraints.layerPositionAtLastLayout() << " adjustStickyLayer " << adjustStickyLayer);
    90 
    91     FloatSize deltaForDescendants = cumulativeDelta;
    92 
    93     if (adjustStickyLayer) {
    94         FloatPoint layerPosition = m_constraints.layerPositionForConstrainingRect(constrainingRect);
    95 
    96         CGRect layerBounds = [m_layer bounds];
    97         CGPoint anchorPoint = [m_layer anchorPoint];
    98         CGPoint newPosition = layerPosition - m_constraints.alignmentOffset() + anchorPoint * layerBounds.size;
    99         [m_layer setPosition:newPosition];
    100 
    101         deltaForDescendants = layerPosition - m_constraints.layerPositionAtLastLayout() + cumulativeDelta;
    102     }
    103 
    104     if (!m_children)
     85    else
    10586        return;
    10687
    107     for (auto& child : *m_children)
    108         child->updateLayersAfterAncestorChange(changedNode, layoutViewport, deltaForDescendants);
     88    LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeStickyNode " << scrollingNodeID() << " relatedNodeScrollPositionDidChange: new viewport " << layoutViewport << " constrainingRectAtLastLayout " << m_constraints.constrainingRectAtLastLayout() << " last layer pos " << m_constraints.layerPositionAtLastLayout());
     89
     90    FloatPoint layerPosition = m_constraints.layerPositionForConstrainingRect(constrainingRect);
     91
     92    CGRect layerBounds = [m_layer bounds];
     93    CGPoint anchorPoint = [m_layer anchorPoint];
     94    CGPoint newPosition = layerPosition - m_constraints.alignmentOffset() + anchorPoint * layerBounds.size;
     95    [m_layer setPosition:newPosition];
     96
     97    cumulativeDelta += layerPosition - m_constraints.layerPositionAtLastLayout();
    10998}
    11099
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h

    r242031 r242132  
    5454    ScrollingEventResult handleWheelEvent(const PlatformWheelEvent&) override;
    5555
    56     FloatPoint scrollPosition() const override;
    57     void setScrollPosition(const FloatPoint&, ScrollPositionClamp = ScrollPositionClamp::ToContentEdges) override;
    58 
    59     void updateLayersAfterViewportChange(const FloatRect& layoutViewport, double scale) override;
    60 
    61     void setScrollLayerPosition(const FloatPoint&, const FloatRect& layoutViewport) override;
     56    WEBCORE_EXPORT void repositionRelatedLayers() override;
    6257
    6358    FloatPoint minimumScrollPosition() const override;
    6459    FloatPoint maximumScrollPosition() const override;
    6560
    66     void updateMainFramePinState(const FloatPoint& scrollPosition);
     61    void updateMainFramePinState();
    6762
    6863    unsigned exposedUnfilledArea() const;
    6964
    7065private:
     66    FloatPoint adjustedScrollPosition(const FloatPoint&, ScrollPositionClamp) const override;
     67
     68    void currentScrollPositionChanged() override;
     69    void repositionScrollingLayers() override;
     70
    7171    RetainPtr<CALayer> m_rootContentsLayer;
    7272    RetainPtr<CALayer> m_counterScrollingLayer;
     
    7777    RetainPtr<NSScrollerImp> m_verticalScrollerImp;
    7878    RetainPtr<NSScrollerImp> m_horizontalScrollerImp;
    79     FloatPoint m_probableMainThreadScrollPosition;
    80    
     79
    8180    ScrollingTreeScrollingNodeDelegateMac m_delegate;
    8281   
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm

    r241997 r242132  
    126126
    127127    bool logScrollingMode = !m_hadFirstUpdate;
    128     if (scrollingStateNode.hasChangedProperty(ScrollingStateFrameScrollingNode::ReasonsForSynchronousScrolling)) {
    129         if (shouldUpdateScrollLayerPositionSynchronously()) {
    130             // We're transitioning to the slow "update scroll layer position on the main thread" mode.
    131             // Initialize the probable main thread scroll position with the current scroll layer position.
    132             if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition))
    133                 m_probableMainThreadScrollPosition = scrollingStateNode.requestedScrollPosition();
    134             else {
    135                 CGPoint scrollLayerPosition = scrolledContentsLayer().position;
    136                 m_probableMainThreadScrollPosition = FloatPoint(-scrollLayerPosition.x, -scrollLayerPosition.y);
    137             }
    138         }
    139 
     128    if (scrollingStateNode.hasChangedProperty(ScrollingStateFrameScrollingNode::ReasonsForSynchronousScrolling))
    140129        logScrollingMode = true;
    141     }
    142 
    143     // FIXME: wrong if we're not the main frame.
    144     if (logScrollingMode && scrollingTree().scrollingPerformanceLoggingEnabled())
     130
     131    if (logScrollingMode && isRootNode() && scrollingTree().scrollingPerformanceLoggingEnabled())
    145132        scrollingTree().reportSynchronousScrollingReasonsChanged(MonotonicTime::now(), synchronousScrollingReasons());
    146133
     
    170157    // Update the scroll position after child nodes have been updated, because they need to have updated their constraints before any scrolling happens.
    171158    if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition))
    172         setScrollPosition(scrollingStateNode.requestedScrollPosition());
    173 
    174     if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrolledContentsLayer)
     159        scrollTo(scrollingStateNode.requestedScrollPosition());
     160
     161    if (isRootNode()
     162        && (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrolledContentsLayer)
    175163        || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::TotalContentsSize)
    176         || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollableAreaSize))
    177         updateMainFramePinState(scrollPosition());
     164        || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollableAreaSize)))
     165        updateMainFramePinState();
    178166}
    179167
     
    204192
    205193#if ENABLE(CSS_SCROLL_SNAP)
    206     // FIXME: wrong if we're not the main frame.
    207     scrollingTree().setMainFrameIsScrollSnapping(m_delegate.isScrollSnapInProgress());
     194    if (isRootNode())
     195        scrollingTree().setMainFrameIsScrollSnapping(m_delegate.isScrollSnapInProgress());
     196
    208197    if (m_delegate.activeScrollSnapIndexDidChange())
    209198        scrollingTree().setActiveScrollSnapIndices(scrollingNodeID(), m_delegate.activeScrollSnapIndexForAxis(ScrollEventAxis::Horizontal), m_delegate.activeScrollSnapIndexForAxis(ScrollEventAxis::Vertical));
     
    216205}
    217206
    218 FloatPoint ScrollingTreeFrameScrollingNodeMac::scrollPosition() const
    219 {
     207FloatPoint ScrollingTreeFrameScrollingNodeMac::adjustedScrollPosition(const FloatPoint& position, ScrollPositionClamp clamp) const
     208{
     209    FloatPoint scrollPosition(roundf(position.x()), roundf(position.y()));
     210    return ScrollingTreeFrameScrollingNode::adjustedScrollPosition(scrollPosition, clamp);
     211}
     212
     213void ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged()
     214{
     215    LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged to " << currentScrollPosition() << " min: " << minimumScrollPosition() << " max: " << maximumScrollPosition() << " sync: " << shouldUpdateScrollLayerPositionSynchronously());
     216
     217    if (isRootNode())
     218        updateMainFramePinState();
     219
    220220    if (shouldUpdateScrollLayerPositionSynchronously())
    221         return m_probableMainThreadScrollPosition;
    222 
    223     return -scrolledContentsLayer().position;
    224 }
    225 
    226 void ScrollingTreeFrameScrollingNodeMac::setScrollPosition(const FloatPoint& position, ScrollPositionClamp clamp)
    227 {
    228     LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeFrameScrollingNodeMac::setScrollPosition " << position << " scrollPosition(): " << this->scrollPosition() << " min: " << minimumScrollPosition() << " max: " << maximumScrollPosition());
    229 
    230     // Scroll deltas can be non-integral with some input devices, so scrollPosition may not be integral.
    231     // FIXME: when we support half-pixel scroll positions on Retina displays, this will need to round to half pixels.
    232     FloatPoint scrollPosition(roundf(position.x()), roundf(position.y()));
    233 
    234     if (clamp == ScrollPositionClamp::ToContentEdges)
    235         scrollPosition = clampScrollPosition(scrollPosition);
    236 
    237     // FIXME: wrong if we're not the main frame.
    238     updateMainFramePinState(scrollPosition);
    239 
    240     FloatRect newLayoutViewport = layoutViewportForScrollPosition(scrollPosition, frameScaleFactor());
    241     setLayoutViewport(newLayoutViewport);
    242     auto layoutViewportOrigin = newLayoutViewport.location();
    243 
    244     if (shouldUpdateScrollLayerPositionSynchronously()) {
    245         m_probableMainThreadScrollPosition = scrollPosition;
    246         scrollingTree().scrollingTreeNodeDidScroll(scrollingNodeID(), scrollPosition, layoutViewportOrigin, ScrollingLayerPositionAction::Set);
    247     } else {
    248         // This should call the base class once we clean up the layoutViewportOrigin stuff.
    249         setScrollLayerPosition(scrollPosition, layoutViewport());
    250         scrollingTree().scrollingTreeNodeDidScroll(scrollingNodeID(), scrollPosition, layoutViewportOrigin);
    251     }
     221        scrollingTree().scrollingTreeNodeDidScroll(*this, ScrollingLayerPositionAction::Set);
     222    else
     223        ScrollingTreeFrameScrollingNode::currentScrollPositionChanged();
    252224
    253225    if (scrollingTree().scrollingPerformanceLoggingEnabled()) {
     
    260232}
    261233
    262 void ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition(const FloatPoint& position, const FloatRect& layoutViewport)
    263 {
    264     ASSERT(!shouldUpdateScrollLayerPositionSynchronously());
    265 
    266     scrolledContentsLayer().position = -position;
    267 
    268     FloatRect visibleContentRect(position, scrollableAreaSize());
     234void ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers()
     235{
     236    scrolledContentsLayer().position = -currentScrollPosition();
     237}
     238
     239void ScrollingTreeFrameScrollingNodeMac::repositionRelatedLayers()
     240{
     241    auto scrollPosition = currentScrollPosition();
     242    auto layoutViewport = this->layoutViewport();
     243
     244    FloatRect visibleContentRect(scrollPosition, scrollableAreaSize());
    269245
    270246    if (m_counterScrollingLayer)
     
    273249    float topContentInset = this->topContentInset();
    274250    if (m_insetClipLayer && m_rootContentsLayer && topContentInset) {
    275         m_insetClipLayer.get().position = FloatPoint(m_insetClipLayer.get().position.x, FrameView::yPositionForInsetClipLayer(position, topContentInset));
    276         m_rootContentsLayer.get().position = FrameView::positionForRootContentLayer(position, scrollOrigin(), topContentInset, headerHeight());
     251        m_insetClipLayer.get().position = FloatPoint(m_insetClipLayer.get().position.x, FrameView::yPositionForInsetClipLayer(scrollPosition, topContentInset));
     252        m_rootContentsLayer.get().position = FrameView::positionForRootContentLayer(scrollPosition, scrollOrigin(), topContentInset, headerHeight());
    277253        if (m_contentShadowLayer)
    278254            m_contentShadowLayer.get().position = m_rootContentsLayer.get().position;
     
    285261        float horizontalScrollOffsetForBanner = layoutViewport.x();
    286262        if (m_headerLayer)
    287             m_headerLayer.get().position = FloatPoint(horizontalScrollOffsetForBanner, FrameView::yPositionForHeaderLayer(position, topContentInset));
     263            m_headerLayer.get().position = FloatPoint(horizontalScrollOffsetForBanner, FrameView::yPositionForHeaderLayer(scrollPosition, topContentInset));
    288264
    289265        if (m_footerLayer)
    290             m_footerLayer.get().position = FloatPoint(horizontalScrollOffsetForBanner, FrameView::yPositionForFooterLayer(position, topContentInset, totalContentsSize().height(), footerHeight()));
     266            m_footerLayer.get().position = FloatPoint(horizontalScrollOffsetForBanner, FrameView::yPositionForFooterLayer(scrollPosition, topContentInset, totalContentsSize().height(), footerHeight()));
    291267    }
    292268
     
    298274            float presentationValue;
    299275            float overhangAmount;
    300             ScrollableArea::computeScrollbarValueAndOverhang(position.y(), totalContentsSize().height(), visibleContentRect.height(), presentationValue, overhangAmount);
     276            ScrollableArea::computeScrollbarValueAndOverhang(scrollPosition.y(), totalContentsSize().height(), visibleContentRect.height(), presentationValue, overhangAmount);
    301277            [m_verticalScrollerImp setPresentationValue:presentationValue];
    302278        }
     
    305281            float presentationValue;
    306282            float overhangAmount;
    307             ScrollableArea::computeScrollbarValueAndOverhang(position.x(), totalContentsSize().width(), visibleContentRect.width(), presentationValue, overhangAmount);
     283            ScrollableArea::computeScrollbarValueAndOverhang(scrollPosition.x(), totalContentsSize().width(), visibleContentRect.width(), presentationValue, overhangAmount);
    308284            [m_horizontalScrollerImp setPresentationValue:presentationValue];
    309285        }
     
    312288        [CATransaction commit];
    313289    }
    314 
    315     if (!m_children)
    316         return;
    317 
    318     for (auto& child : *m_children)
    319         child->updateLayersAfterAncestorChange(*this, layoutViewport, FloatSize());
    320 }
    321 
    322 void ScrollingTreeFrameScrollingNodeMac::updateLayersAfterViewportChange(const FloatRect&, double)
    323 {
    324     ASSERT_NOT_REACHED();
    325290}
    326291
     
    346311}
    347312
    348 void ScrollingTreeFrameScrollingNodeMac::updateMainFramePinState(const FloatPoint& scrollPosition)
    349 {
     313void ScrollingTreeFrameScrollingNodeMac::updateMainFramePinState()
     314{
     315    ASSERT(isRootNode());
     316
     317    auto scrollPosition = currentScrollPosition();
    350318    bool pinnedToTheLeft = scrollPosition.x() <= minimumScrollPosition().x();
    351319    bool pinnedToTheRight = scrollPosition.x() >= maximumScrollPosition().x();
     
    380348    }
    381349
    382     FloatPoint scrollPosition = this->scrollPosition();
    383     FloatRect viewPortRect(FloatPoint(), scrollableAreaSize());
     350    FloatPoint scrollPosition = currentScrollPosition();
     351    FloatRect viewPortRect({ }, scrollableAreaSize());
    384352    return TileController::blankPixelCountForTiles(tiles, viewPortRect, IntPoint(-scrollPosition.x(), -scrollPosition.y()));
    385353}
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h

    r242031 r242132  
    4646    void commitStateAfterChildren(const ScrollingStateNode&) override;
    4747   
    48     FloatPoint scrollPosition() const override;
    49     void setScrollPosition(const FloatPoint&, ScrollPositionClamp = ScrollPositionClamp::ToContentEdges) override;
     48    FloatPoint adjustedScrollPosition(const FloatPoint&, ScrollPositionClamp) const override;
    5049
    51     void setScrollLayerPosition(const FloatPoint&, const FloatRect& layoutViewport) override;
    52 
    53     void updateLayersAfterViewportChange(const FloatRect&, double) override { }
    54     void updateLayersAfterDelegatedScroll(const FloatPoint& scrollPosition) override;
    55 
    56     void updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta) override;
     50    void repositionScrollingLayers() override;
    5751
    5852    ScrollingEventResult handleWheelEvent(const PlatformWheelEvent&) override;
    5953
    6054    ScrollingTreeScrollingNodeDelegateMac m_delegate;
    61 
    6255};
    6356
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm

    r242031 r242132  
    4747}
    4848
    49 ScrollingTreeOverflowScrollingNodeMac::~ScrollingTreeOverflowScrollingNodeMac()
    50 {
    51 }
     49ScrollingTreeOverflowScrollingNodeMac::~ScrollingTreeOverflowScrollingNodeMac() = default;
    5250
    5351void ScrollingTreeOverflowScrollingNodeMac::commitStateBeforeChildren(const ScrollingStateNode& stateNode)
     
    9290}
    9391
    94 
    95 
    96 void ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta)
     92FloatPoint ScrollingTreeOverflowScrollingNodeMac::adjustedScrollPosition(const FloatPoint& position, ScrollPositionClamp clamp) const
    9793{
    98     UNUSED_PARAM(changedNode);
    99     UNUSED_PARAM(layoutViewport);
    100     UNUSED_PARAM(cumulativeDelta);
     94    FloatPoint scrollPosition(roundf(position.x()), roundf(position.y()));
     95    return ScrollingTreeOverflowScrollingNode::adjustedScrollPosition(scrollPosition, clamp);
    10196}
    10297
    103 FloatPoint ScrollingTreeOverflowScrollingNodeMac::scrollPosition() const
     98void ScrollingTreeOverflowScrollingNodeMac::repositionScrollingLayers()
    10499{
    105     return -scrolledContentsLayer().position;
    106 }
    107 
    108 void ScrollingTreeOverflowScrollingNodeMac::setScrollPosition(const FloatPoint& scrollPosition, ScrollPositionClamp clamp)
    109 {
    110     LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeOverflowScrollingNodeMac::setScrollPosition " << scrollPosition << " from " << this->scrollPosition() << " (min: " << minimumScrollPosition() << " max: " << maximumScrollPosition() << ")");
    111 
    112     // Scroll deltas can be non-integral with some input devices, so scrollPosition may not be integral.
    113     // FIXME: when we support half-pixel scroll positions on Retina displays, this will need to round to half pixels.
    114     FloatPoint roundedPosition(roundf(scrollPosition.x()), roundf(scrollPosition.y()));
    115 
    116     ScrollingTreeOverflowScrollingNode::setScrollPosition(roundedPosition, clamp);
    117 }
    118 
    119 void ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition(const FloatPoint& scrollPosition, const FloatRect& layoutViewport)
    120 {
    121     LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition " << scrollPosition);
    122 
     100    auto scrollPosition = currentScrollPosition();
    123101    scrolledContentsLayer().position = -scrollPosition;
    124     if (!m_children)
    125         return;
    126 
    127     for (auto& child : *m_children)
    128         child->updateLayersAfterAncestorChange(*this, layoutViewport, { });
    129 }
    130 
    131 void ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterDelegatedScroll(const FloatPoint& scrollPosition)
    132 {
    133     UNUSED_PARAM(scrollPosition);
    134102}
    135103
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm

    r241984 r242132  
    8383bool ScrollingTreeScrollingNodeDelegateMac::isAlreadyPinnedInDirectionOfGesture(const PlatformWheelEvent& wheelEvent, ScrollEventAxis axis)
    8484{
     85    auto scrollPosition = currentScrollPosition();
    8586    switch (axis) {
    8687    case ScrollEventAxis::Vertical:
    87         return (wheelEvent.deltaY() > 0 && scrollPosition().y() <= minimumScrollPosition().y()) || (wheelEvent.deltaY() < 0 && scrollPosition().y() >= maximumScrollPosition().y());
     88        return (wheelEvent.deltaY() > 0 && scrollPosition.y() <= minimumScrollPosition().y()) || (wheelEvent.deltaY() < 0 && scrollPosition.y() >= maximumScrollPosition().y());
    8889    case ScrollEventAxis::Horizontal:
    89         return (wheelEvent.deltaX() > 0 && scrollPosition().x() <= minimumScrollPosition().x()) || (wheelEvent.deltaX() < 0 && scrollPosition().x() >= maximumScrollPosition().x());
     90        return (wheelEvent.deltaX() > 0 && scrollPosition.x() <= minimumScrollPosition().x()) || (wheelEvent.deltaX() < 0 && scrollPosition.x() >= maximumScrollPosition().x());
    9091    }
    9192
     
    133134{
    134135    IntSize stretch;
    135 
    136     if (scrollPosition().y() < minimumScrollPosition().y())
    137         stretch.setHeight(scrollPosition().y() - minimumScrollPosition().y());
    138     else if (scrollPosition().y() > maximumScrollPosition().y())
    139         stretch.setHeight(scrollPosition().y() - maximumScrollPosition().y());
    140 
    141     if (scrollPosition().x() < minimumScrollPosition().x())
    142         stretch.setWidth(scrollPosition().x() - minimumScrollPosition().x());
    143     else if (scrollPosition().x() > maximumScrollPosition().x())
    144         stretch.setWidth(scrollPosition().x() - maximumScrollPosition().x());
     136    auto scrollPosition = currentScrollPosition();
     137
     138    if (scrollPosition.y() < minimumScrollPosition().y())
     139        stretch.setHeight(scrollPosition.y() - minimumScrollPosition().y());
     140    else if (scrollPosition.y() > maximumScrollPosition().y())
     141        stretch.setHeight(scrollPosition.y() - maximumScrollPosition().y());
     142
     143    if (scrollPosition.x() < minimumScrollPosition().x())
     144        stretch.setWidth(scrollPosition.x() - minimumScrollPosition().x());
     145    else if (scrollPosition.x() > maximumScrollPosition().x())
     146        stretch.setWidth(scrollPosition.x() - maximumScrollPosition().x());
    145147
    146148    if (scrollingNode().isRootNode()) {
     
    157159{
    158160    FloatSize limitDelta;
     161    auto scrollPosition = currentScrollPosition();
    159162
    160163    if (fabsf(delta.height()) >= fabsf(delta.width())) {
    161164        if (delta.height() < 0) {
    162165            // We are trying to scroll up. Make sure we are not pinned to the top.
    163             limitDelta.setHeight(scrollPosition().y() - minimumScrollPosition().y());
     166            limitDelta.setHeight(scrollPosition.y() - minimumScrollPosition().y());
    164167        } else {
    165168            // We are trying to scroll down. Make sure we are not pinned to the bottom.
    166             limitDelta.setHeight(maximumScrollPosition().y() - scrollPosition().y());
     169            limitDelta.setHeight(maximumScrollPosition().y() - scrollPosition.y());
    167170        }
    168171    } else if (delta.width()) {
    169172        if (delta.width() < 0) {
    170173            // We are trying to scroll left. Make sure we are not pinned to the left.
    171             limitDelta.setWidth(scrollPosition().x() - minimumScrollPosition().x());
     174            limitDelta.setWidth(scrollPosition.x() - minimumScrollPosition().x());
    172175        } else {
    173176            // We are trying to scroll right. Make sure we are not pinned to the right.
    174             limitDelta.setWidth(maximumScrollPosition().x() - scrollPosition().x());
     177            limitDelta.setWidth(maximumScrollPosition().x() - scrollPosition.x());
    175178        }
    176179    }
     
    217220void ScrollingTreeScrollingNodeDelegateMac::adjustScrollPositionToBoundsIfNecessary()
    218221{
    219     FloatPoint currentScrollPosition = scrollPosition();
    220     FloatPoint constrainedPosition = currentScrollPosition.constrainedBetween(minimumScrollPosition(), maximumScrollPosition());
    221     immediateScrollBy(constrainedPosition - currentScrollPosition);
     222    FloatPoint scrollPosition = currentScrollPosition();
     223    FloatPoint constrainedPosition = scrollPosition.constrainedBetween(minimumScrollPosition(), maximumScrollPosition());
     224    immediateScrollBy(constrainedPosition - scrollPosition);
    222225}
    223226
     
    225228FloatPoint ScrollingTreeScrollingNodeDelegateMac::scrollOffset() const
    226229{
    227     return scrollPosition();
     230    return currentScrollPosition();
    228231}
    229232
    230233void ScrollingTreeScrollingNodeDelegateMac::immediateScrollOnAxis(ScrollEventAxis axis, float delta)
    231234{
    232     const FloatPoint& currentPosition = scrollPosition();
     235    const FloatPoint& scrollPosition = currentScrollPosition();
    233236    FloatPoint change;
    234237    if (axis == ScrollEventAxis::Horizontal)
    235         change = FloatPoint(currentPosition.x() + delta, currentPosition.y());
     238        change = FloatPoint(scrollPosition.x() + delta, scrollPosition.y());
    236239    else
    237         change = FloatPoint(currentPosition.x(), currentPosition.y() + delta);
    238 
    239     immediateScrollBy(change - currentPosition);
     240        change = FloatPoint(scrollPosition.x(), scrollPosition.y() + delta);
     241
     242    immediateScrollBy(change - scrollPosition);
    240243}
    241244
  • trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFixedNode.cpp

    r239667 r242132  
    5555}
    5656
    57 void ScrollingTreeFixedNode::updateLayersAfterAncestorChange(const ScrollingTreeNode&, const FloatRect&, const FloatSize&)
     57void ScrollingTreeFixedNode::relatedNodeScrollPositionDidChange(const ScrollingTreeScrollingNode&, const FloatRect&, FloatSize&)
    5858{
    5959}
  • trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFixedNode.h

    r239667 r242132  
    4343
    4444    void commitStateBeforeChildren(const ScrollingStateNode&) override;
    45     void updateLayersAfterAncestorChange(const ScrollingTreeNode&, const FloatRect&, const FloatSize&) override;
     45    void relatedNodeScrollPositionDidChange(const ScrollingTreeScrollingNode& changedNode, const FloatRect& layoutViewport, FloatSize& cumulativeDelta) override;
    4646};
    4747
  • trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp

    r241984 r242132  
    5050}
    5151
    52 FloatPoint ScrollingTreeFrameScrollingNodeNicosia::scrollPosition() const
    53 {
    54     return { };
    55 }
    56 
    57 void ScrollingTreeFrameScrollingNodeNicosia::setScrollLayerPosition(const FloatPoint&, const FloatRect&)
    58 {
    59 }
    60 
    61 void ScrollingTreeFrameScrollingNodeNicosia::updateLayersAfterViewportChange(const FloatRect&, double)
     52void ScrollingTreeFrameScrollingNodeNicosia::repositionScrollingLayers()
    6253{
    6354}
  • trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h

    r241984 r242132  
    4444    ScrollingEventResult handleWheelEvent(const PlatformWheelEvent&) override;
    4545
    46     FloatPoint scrollPosition() const override;
    47 
    48     void setScrollLayerPosition(const FloatPoint&, const FloatRect&) override;
    49 
    50     void updateLayersAfterViewportChange(const FloatRect&, double) override;
     46    void repositionScrollingLayers() override;
    5147};
    5248
  • trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeStickyNode.cpp

    r239667 r242132  
    5555}
    5656
    57 void ScrollingTreeStickyNode::updateLayersAfterAncestorChange(const ScrollingTreeNode&, const FloatRect&, const FloatSize&)
     57void ScrollingTreeStickyNode::relatedNodeScrollPositionDidChange(const ScrollingTreeScrollingNode&, const FloatRect&, FloatSize&)
    5858{
    5959}
  • trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeStickyNode.h

    r239667 r242132  
    4343
    4444    void commitStateBeforeChildren(const ScrollingStateNode&) override;
    45     void updateLayersAfterAncestorChange(const ScrollingTreeNode&, const FloatRect&, const FloatSize&) override;
     45    void relatedNodeScrollPositionDidChange(const ScrollingTreeScrollingNode& changedNode, const FloatRect& layoutViewport, FloatSize& cumulativeDelta) override;
    4646};
    4747
  • trunk/Source/WebKit/ChangeLog

    r242131 r242132  
     12019-02-26  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Have a single notion of scroll position in the scrolling tree and derive layoutViewport from it
     4        https://bugs.webkit.org/show_bug.cgi?id=194973
     5
     6        Reviewed by Antti Koivisto.
     7
     8        This patch cleans up how the scrolling tree responds to scrolls.
     9
     10        First, ScrollingTreeScrollingNode::m_currentScrollPosition is "truth" for scrolling thread/
     11        UI process scroll position.
     12
     13        On macOS where handleWheelEvent on the scrolling thread changes scroll position, the
     14        bottleneck is ScrollingTreeScrollingNode::scrollTo() which sets the new scroll position,
     15        update the visual viewport (for frame scrolls) updates the scrolledContentsLayer position,
     16        updates related layers on this node (counter-scrolling layers etc), and then tells the
     17        scrolling tree, which recurses through descendant nodes so they can adjust their layer
     18        positions.
     19
     20        On iOS, the bottleneck is ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling(),
     21        which does the above other than setting scrolledContentsLayer (since we're reacting to
     22        layer state changes, not producing them).
     23
     24        updateLayersAfterAncestorChange() is renamed to relatedNodeScrollPositionDidChange(), and
     25        ScrollingTree does the tree walk so classes don't have to implement
     26        updateLayersAfterAncestorChange() just to talk children. The ScrollingTree tree walk knows
     27        how to get the correct layoutViewport and to stop at frame boundaries (layer updates never
     28        need to cross frame boundaries).
     29
     30        We preserve 'cumulativeDelta'; it's necessary for things like fixed inside overflow:scroll,
     31        since the fixed state was computed with the "layout" scroll position, so we have to account
     32        for the scroll delta since the last committed position. It's possible we could improve this
     33        in future.
     34
     35        * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
     36        (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
     37        * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
     38        (WebKit::RemoteScrollingCoordinatorProxy::viewportChangedViaDelegatedScrolling):
     39        (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):
     40        * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
     41        * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
     42        (WebKit::RemoteScrollingTree::scrollingTreeNodeDidScroll):
     43        * UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
     44        * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
     45        (WebKit::RemoteScrollingCoordinatorProxy::currentLayoutViewport const):
     46        * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h:
     47        * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
     48        (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren):
     49        (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::repositionScrollingLayers):
     50        (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::repositionRelatedLayers):
     51        (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::scrollPosition const): Deleted.
     52        (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::setScrollPosition): Deleted.
     53        (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::setScrollLayerPosition): Deleted.
     54        (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateChildNodesAfterScroll): Deleted.
     55        (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterDelegatedScroll): Deleted.
     56        (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterViewportChange): Deleted.
     57        (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterAncestorChange): Deleted.
     58        * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
     59        * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
     60        (WebKit::ScrollingTreeOverflowScrollingNodeIOS::repositionScrollingLayers):
     61        (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterAncestorChange): Deleted.
     62        (WebKit::ScrollingTreeOverflowScrollingNodeIOS::scrollPosition const): Deleted.
     63        (WebKit::ScrollingTreeOverflowScrollingNodeIOS::setScrollLayerPosition): Deleted.
     64        (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterDelegatedScroll): Deleted.
     65        * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
     66        * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
     67        (WebKit::ScrollingTreeScrollingNodeDelegateIOS::ScrollingTreeScrollingNodeDelegateIOS):
     68        (WebKit::ScrollingTreeScrollingNodeDelegateIOS::repositionScrollingLayers):
     69        (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll):
     70        (WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateLayersAfterAncestorChange): Deleted.
     71        (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollPosition const): Deleted.
     72        (WebKit::ScrollingTreeScrollingNodeDelegateIOS::setScrollLayerPosition): Deleted.
     73        (WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateChildNodesAfterScroll): Deleted.
     74        (WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll const): Deleted.
     75        * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm:
     76        (WebKit::ScrollerPairMac::updateValues):
     77        (WebKit::ScrollerPairMac::valuesForOrientation):
     78        * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp:
     79        (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::repositionRelatedLayers):
     80        (WebKit::ScrollingTreeFrameScrollingNodeRemoteMac::setScrollLayerPosition): Deleted.
     81        * UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h:
     82        * UIProcess/ios/WKContentView.mm:
     83        (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
     84
    1852019-02-27  Alex Christensen  <achristensen@webkit.org>
    286
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm

    r242031 r242132  
    222222        // If we got a new layer for a fixed or sticky node, its position from the WebProcess is probably stale. We need to re-run the "viewport" changed logic to udpate it with our UI-side state.
    223223        FloatRect layoutViewport = m_webPageProxy.computeCustomFixedPositionRect(m_webPageProxy.unobscuredContentRect(), m_webPageProxy.unobscuredContentRectRespectingInputViewBounds(), m_webPageProxy.customFixedPositionRect(), m_webPageProxy.displayedContentScale(), FrameView::LayoutViewportConstraint::Unconstrained);
    224         m_webPageProxy.scrollingCoordinatorProxy()->viewportChangedViaDelegatedScrolling(layoutViewport, m_webPageProxy.displayedContentScale());
     224        m_webPageProxy.scrollingCoordinatorProxy()->viewportChangedViaDelegatedScrolling(m_webPageProxy.unobscuredContentRect().location(), layoutViewport, m_webPageProxy.displayedContentScale());
    225225    }
    226226#endif
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp

    r242031 r242132  
    174174}
    175175
    176 void RemoteScrollingCoordinatorProxy::viewportChangedViaDelegatedScrolling(const FloatRect& layoutViewport, double scale)
    177 {
    178     m_scrollingTree->mainFrameViewportChangedViaDelegatedScrolling(layoutViewport, scale);
     176void RemoteScrollingCoordinatorProxy::viewportChangedViaDelegatedScrolling(const FloatPoint& scrollPosition, const FloatRect& layoutViewport, double scale)
     177{
     178    m_scrollingTree->mainFrameViewportChangedViaDelegatedScrolling(scrollPosition, layoutViewport, scale);
    179179}
    180180
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h

    r242031 r242132  
    5959
    6060    // Called externally when native views move around.
    61     void viewportChangedViaDelegatedScrolling(const WebCore::FloatRect& layoutViewport, double scale);
     61    void viewportChangedViaDelegatedScrolling(const WebCore::FloatPoint& scrollPosition, const WebCore::FloatRect& layoutViewport, double scale);
    6262
    6363    void currentSnapPointIndicesDidChange(WebCore::ScrollingNodeID, unsigned horizontal, unsigned vertical);
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp

    r242031 r242132  
    9696#endif
    9797
    98 void RemoteScrollingTree::scrollingTreeNodeDidScroll(ScrollingNodeID nodeID, const FloatPoint& scrollPosition, const Optional<FloatPoint>& layoutViewportOrigin, ScrollingLayerPositionAction scrollingLayerPositionAction)
     98void RemoteScrollingTree::scrollingTreeNodeDidScroll(ScrollingTreeScrollingNode& node, ScrollingLayerPositionAction scrollingLayerPositionAction)
    9999{
    100     m_scrollingCoordinatorProxy.scrollingTreeNodeDidScroll(nodeID, scrollPosition, layoutViewportOrigin, scrollingLayerPositionAction);
     100    Optional<FloatPoint> layoutViewportOrigin;
     101    if (is<ScrollingTreeFrameScrollingNode>(node))
     102        layoutViewportOrigin = downcast<ScrollingTreeFrameScrollingNode>(node).layoutViewport().location();
     103
     104    m_scrollingCoordinatorProxy.scrollingTreeNodeDidScroll(node.scrollingNodeID(), node.currentScrollPosition(), layoutViewportOrigin, scrollingLayerPositionAction);
    101105}
    102106
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h

    r242031 r242132  
    5252    const RemoteScrollingCoordinatorProxy& scrollingCoordinatorProxy() const { return m_scrollingCoordinatorProxy; }
    5353
    54     void scrollingTreeNodeDidScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, const Optional<WebCore::FloatPoint>& layoutViewportOrigin, WebCore::ScrollingLayerPositionAction = WebCore::ScrollingLayerPositionAction::Sync) override;
     54    void scrollingTreeNodeDidScroll(WebCore::ScrollingTreeScrollingNode&, WebCore::ScrollingLayerPositionAction = WebCore::ScrollingLayerPositionAction::Sync) override;
    5555    void scrollingTreeNodeRequestsScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, bool representsProgrammaticScroll) override;
    5656
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm

    r242031 r242132  
    9696FloatRect RemoteScrollingCoordinatorProxy::currentLayoutViewport() const
    9797{
     98    // FIXME: does this give a different value to the last value pushed onto us?
    9899    return m_webPageProxy.computeCustomFixedPositionRect(m_webPageProxy.unobscuredContentRect(), m_webPageProxy.unobscuredContentRectRespectingInputViewBounds(), m_webPageProxy.customFixedPositionRect(),
    99100        m_webPageProxy.displayedContentScale(), FrameView::LayoutViewportConstraint::Unconstrained);
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h

    r242031 r242132  
    4848    FloatPoint maximumScrollPosition() const override;
    4949
    50     WebCore::FloatPoint scrollPosition() const override;
    51     void setScrollPosition(const WebCore::FloatPoint&, WebCore::ScrollPositionClamp = WebCore::ScrollPositionClamp::ToContentEdges) override;
    52     void setScrollLayerPosition(const WebCore::FloatPoint&, const WebCore::FloatRect& layoutViewport) override;
    53 
    54     void updateChildNodesAfterScroll(const FloatPoint&);
    55 
    56     void updateLayersAfterDelegatedScroll(const WebCore::FloatPoint& scrollPosition) override;
    57     void updateLayersAfterViewportChange(const WebCore::FloatRect& layoutViewport, double scale) override;
    58     void updateLayersAfterAncestorChange(const WebCore::ScrollingTreeNode& changedNode, const WebCore::FloatRect& layoutViewport, const WebCore::FloatSize& cumulativeDelta) override;
     50    void repositionScrollingLayers() override;
     51    void repositionRelatedLayers() override;
    5952
    6053    std::unique_ptr<ScrollingTreeScrollingNodeDelegateIOS> m_scrollingNodeDelegate;
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm

    r242031 r242132  
    8383    // Update the scroll position after child nodes have been updated, because they need to have updated their constraints before any scrolling happens.
    8484    if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition))
    85         setScrollPosition(scrollingStateNode.requestedScrollPosition());
     85        scrollTo(scrollingStateNode.requestedScrollPosition());
    8686
    8787    if (m_scrollingNodeDelegate)
     
    110110}
    111111
    112 FloatPoint ScrollingTreeFrameScrollingNodeRemoteIOS::scrollPosition() const
    113 {
    114     if (m_scrollingNodeDelegate)
    115         return m_scrollingNodeDelegate->scrollPosition();
    116 
    117     return -scrolledContentsLayer().position;
    118 }
    119 
    120 void ScrollingTreeFrameScrollingNodeRemoteIOS::setScrollPosition(const FloatPoint& position, ScrollPositionClamp clamp)
    121 {
    122     auto scrollPosition = position;
    123     if (clamp == ScrollPositionClamp::ToContentEdges)
    124         scrollPosition = clampScrollPosition(scrollPosition);
    125 
    126     FloatRect newLayoutViewport = layoutViewportForScrollPosition(scrollPosition, frameScaleFactor());
    127     setLayoutViewport(newLayoutViewport);
    128     auto layoutViewportOrigin = newLayoutViewport.location();
    129 
    130     setScrollLayerPosition(scrollPosition, layoutViewport());
    131     scrollingTree().scrollingTreeNodeDidScroll(scrollingNodeID(), scrollPosition, layoutViewportOrigin);
    132 }
    133 
    134 void ScrollingTreeFrameScrollingNodeRemoteIOS::setScrollLayerPosition(const FloatPoint& scrollPosition, const FloatRect& layoutViewport)
     112void ScrollingTreeFrameScrollingNodeRemoteIOS::repositionScrollingLayers()
    135113{
    136114    if (m_scrollingNodeDelegate) {
    137         m_scrollingNodeDelegate->setScrollLayerPosition(scrollPosition);
     115        m_scrollingNodeDelegate->repositionScrollingLayers();
    138116        return;
    139117    }
    140118
     119    auto scrollPosition = currentScrollPosition();
     120    // FIXME: This is always wrong on iOS. Maybe assert that we always have a delegate.
    141121    [scrolledContentsLayer() setPosition:-scrollPosition];
    142     updateChildNodesAfterScroll(scrollPosition);
    143122}
    144123
    145 void ScrollingTreeFrameScrollingNodeRemoteIOS::updateChildNodesAfterScroll(const FloatPoint& scrollPosition)
     124void ScrollingTreeFrameScrollingNodeRemoteIOS::repositionRelatedLayers()
    146125{
    147     ScrollBehaviorForFixedElements behaviorForFixed = scrollBehaviorForFixedElements();
    148     FloatRect viewportRect(scrollPosition, scrollableAreaSize());
    149     FloatPoint scrollPositionForFixedChildren = FrameView::scrollPositionForFixedPosition(enclosingLayoutRect(viewportRect), LayoutSize(totalContentsSize()), LayoutPoint(scrollPosition), scrollOrigin(), frameScaleFactor(), fixedElementsLayoutRelativeToFrame(), behaviorForFixed, headerHeight(), footerHeight());
     126    auto layoutViewport = this->layoutViewport();
    150127
    151     [m_counterScrollingLayer setPosition:scrollPositionForFixedChildren];
     128    [m_counterScrollingLayer setPosition:layoutViewport.location()];
    152129
     130    // FIXME: I don' think we never have headers and footers on iOS.
    153131    if (m_headerLayer || m_footerLayer) {
    154132        // Generally the banners should have the same horizontal-position computation as a fixed element. However,
    155133        // the banners are not affected by the frameScaleFactor(), so if there is currently a non-1 frameScaleFactor()
    156134        // then we should recompute scrollPositionForFixedChildren for the banner with a scale factor of 1.
    157         float horizontalScrollOffsetForBanner = scrollPositionForFixedChildren.x();
    158         if (frameScaleFactor() != 1)
    159             horizontalScrollOffsetForBanner = FrameView::scrollPositionForFixedPosition(enclosingLayoutRect(viewportRect), LayoutSize(totalContentsSize()), LayoutPoint(scrollPosition), scrollOrigin(), 1, fixedElementsLayoutRelativeToFrame(), behaviorForFixed, headerHeight(), footerHeight()).x();
    160 
    161135        if (m_headerLayer)
    162             [m_headerLayer setPosition:FloatPoint(horizontalScrollOffsetForBanner, 0)];
     136            [m_headerLayer setPosition:FloatPoint(layoutViewport.x(), 0)];
    163137
    164138        if (m_footerLayer)
    165             [m_footerLayer setPosition:FloatPoint(horizontalScrollOffsetForBanner, totalContentsSize().height() - footerHeight())];
     139            [m_footerLayer setPosition:FloatPoint(layoutViewport.x(), totalContentsSize().height() - footerHeight())];
    166140    }
    167    
    168     if (!m_children)
    169         return;
    170 
    171 
    172     FloatRect layoutViewport;
    173     if (isRootNode())
    174         layoutViewport = this->layoutViewport();
    175     else
    176         layoutViewport = FloatRect(scrollPosition, scrollableAreaSize()); // FIXME: We'll just use layoutViewport() once we correctly update it after a scroll.
    177 
    178     for (auto& child : *m_children)
    179         child->updateLayersAfterAncestorChange(*this, layoutViewport, FloatSize());
    180 }
    181 
    182 void ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterDelegatedScroll(const FloatPoint& scrollPosition)
    183 {
    184     if (m_scrollingNodeDelegate) {
    185         m_scrollingNodeDelegate->updateChildNodesAfterScroll(scrollPosition);
    186         return;
    187     }
    188 
    189     updateChildNodesAfterScroll(scrollPosition);
    190 }
    191 
    192 void ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterViewportChange(const FloatRect& layoutViewport, double /*scale*/)
    193 {
    194     // Note: we never currently have a m_counterScrollingLayer (which is used for background-attachment:fixed) on iOS.
    195     [m_counterScrollingLayer setPosition:layoutViewport.location()];
    196 
    197     if (!m_children)
    198         return;
    199 
    200     for (auto& child : *m_children)
    201         child->updateLayersAfterAncestorChange(*this, layoutViewport, FloatSize());
    202 }
    203 
    204 void ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta)
    205 {
    206     if (m_scrollingNodeDelegate) {
    207         m_scrollingNodeDelegate->updateLayersAfterAncestorChange(changedNode, layoutViewport, cumulativeDelta);
    208         return;
    209     }
    210 
    211     if (!m_children)
    212         return;
    213 
    214     FloatRect currFrameLayoutViewport(scrollPosition(), scrollableAreaSize()); // FIXME: use layoutViewport() once it's correctly updated.
    215     for (auto& child : *m_children)
    216         child->updateLayersAfterAncestorChange(changedNode, currFrameLayoutViewport, { });
    217141}
    218142
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h

    r242031 r242132  
    4545    void commitStateAfterChildren(const WebCore::ScrollingStateNode&) override;
    4646   
    47     WebCore::FloatPoint scrollPosition() const override;
    48 
    49     void setScrollLayerPosition(const WebCore::FloatPoint&, const WebCore::FloatRect& layoutViewport) override;
    50 
    51     void updateLayersAfterViewportChange(const WebCore::FloatRect& fixedPositionRect, double scale) override { }
    52     void updateLayersAfterDelegatedScroll(const WebCore::FloatPoint& scrollPosition) override;
    53 
    54     void updateLayersAfterAncestorChange(const WebCore::ScrollingTreeNode& changedNode, const WebCore::FloatRect& layoutViewport, const WebCore::FloatSize& cumulativeDelta) override;
     47    void repositionScrollingLayers() override;
    5548
    5649    std::unique_ptr<ScrollingTreeScrollingNodeDelegateIOS> m_scrollingNodeDelegate;
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm

    r242031 r242132  
    6767}
    6868
    69 void ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta)
     69void ScrollingTreeOverflowScrollingNodeIOS::repositionScrollingLayers()
    7070{
    71     m_scrollingNodeDelegate->updateLayersAfterAncestorChange(changedNode, layoutViewport, cumulativeDelta);
    72 }
    73 
    74 FloatPoint ScrollingTreeOverflowScrollingNodeIOS::scrollPosition() const
    75 {
    76     return m_scrollingNodeDelegate->scrollPosition();
    77 }
    78 
    79 void ScrollingTreeOverflowScrollingNodeIOS::setScrollLayerPosition(const FloatPoint& scrollPosition, const FloatRect&)
    80 {
    81     m_scrollingNodeDelegate->setScrollLayerPosition(scrollPosition);
    82 }
    83 
    84 void ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterDelegatedScroll(const FloatPoint& scrollPosition)
    85 {
    86     m_scrollingNodeDelegate->updateChildNodesAfterScroll(scrollPosition);
     71    m_scrollingNodeDelegate->repositionScrollingLayers();
    8772}
    8873
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h

    r242031 r242132  
    5555    void scrollDidEnd() const;
    5656    void scrollViewWillStartPanGesture() const;
    57     void scrollViewDidScroll(const WebCore::FloatPoint& scrollPosition, bool inUserInteraction) const;
     57    void scrollViewDidScroll(const WebCore::FloatPoint& scrollPosition, bool inUserInteraction);
     58
    5859    void currentSnapPointIndicesDidChange(unsigned horizontal, unsigned vertical) const;
    5960    CALayer *scrollLayer() const { return m_scrollLayer.get(); }
     
    6263    void commitStateBeforeChildren(const WebCore::ScrollingStateScrollingNode&);
    6364    void commitStateAfterChildren(const WebCore::ScrollingStateScrollingNode&);
    64     void updateLayersAfterAncestorChange(const WebCore::ScrollingTreeNode& changedNode, const WebCore::FloatRect& layoutViewport, const WebCore::FloatSize& cumulativeDelta);
    65     WebCore::FloatPoint scrollPosition() const;
    66     void setScrollLayerPosition(const WebCore::FloatPoint&);
    67     void updateChildNodesAfterScroll(const WebCore::FloatPoint& scrollPosition);
     65
     66    void repositionScrollingLayers();
     67
    6868#if ENABLE(POINTER_EVENTS)
    6969    Optional<TouchActionData> touchActionData() const;
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm

    r242031 r242132  
    188188ScrollingTreeScrollingNodeDelegateIOS::ScrollingTreeScrollingNodeDelegateIOS(ScrollingTreeScrollingNode& scrollingNode)
    189189    : ScrollingTreeScrollingNodeDelegate(scrollingNode)
    190     , m_updatingFromStateNode(false)
    191190{
    192191}
     
    270269}
    271270
    272 void ScrollingTreeScrollingNodeDelegateIOS::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta)
    273 {
    274     if (!scrollingNode().children())
    275         return;
    276 
    277     FloatSize scrollDelta = lastCommittedScrollPosition() - scrollingNode().scrollPosition();
    278 
    279     for (auto& child : *scrollingNode().children())
    280         child->updateLayersAfterAncestorChange(changedNode, layoutViewport, cumulativeDelta + scrollDelta);
    281 }
    282 
    283 FloatPoint ScrollingTreeScrollingNodeDelegateIOS::scrollPosition() const
    284 {
    285     BEGIN_BLOCK_OBJC_EXCEPTIONS
    286     UIScrollView *scrollView = (UIScrollView *)[scrollLayer() delegate];
    287     ASSERT([scrollView isKindOfClass:[UIScrollView self]]);
    288     return [scrollView contentOffset];
    289     END_BLOCK_OBJC_EXCEPTIONS
    290 }
    291 
    292 void ScrollingTreeScrollingNodeDelegateIOS::setScrollLayerPosition(const FloatPoint& scrollPosition)
    293 {
     271void ScrollingTreeScrollingNodeDelegateIOS::repositionScrollingLayers()
     272{
     273    auto scrollPosition = scrollingNode().currentScrollPosition();
     274
    294275    BEGIN_BLOCK_OBJC_EXCEPTIONS
    295276    UIScrollView *scrollView = (UIScrollView *)[scrollLayer() delegate];
     
    297278    [scrollView setContentOffset:scrollPosition];
    298279    END_BLOCK_OBJC_EXCEPTIONS
    299 
    300     updateChildNodesAfterScroll(scrollPosition);
    301 }
    302 
    303 void ScrollingTreeScrollingNodeDelegateIOS::updateChildNodesAfterScroll(const FloatPoint& scrollPosition)
    304 {
    305     if (!scrollingNode().children())
    306         return;
    307 
    308     FloatRect layoutViewport;
    309     auto* frameNode = scrollingNode().enclosingFrameNodeIncludingSelf();
    310     if (frameNode)
    311         layoutViewport = frameNode->layoutViewport();
    312 
    313     auto scrollDelta = lastCommittedScrollPosition() - scrollPosition;
    314 
    315     for (auto& child : *scrollingNode().children())
    316         child->updateLayersAfterAncestorChange(scrollingNode(), layoutViewport, scrollDelta);
    317280}
    318281
     
    332295}
    333296
    334 void ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll(const FloatPoint& scrollPosition, bool inUserInteraction) const
     297void ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll(const FloatPoint& scrollPosition, bool inUserInteraction)
    335298{
    336299    if (m_updatingFromStateNode)
    337300        return;
    338301
    339     scrollingTree().scrollPositionChangedViaDelegatedScrolling(scrollingNode().scrollingNodeID(), scrollPosition, inUserInteraction);
     302    scrollingNode().wasScrolledByDelegatedScrolling(scrollPosition);
    340303}
    341304
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm

    r240787 r242132  
    176176void ScrollerPairMac::updateValues()
    177177{
    178     auto position = m_scrollingNode.scrollPosition();
     178    auto position = m_scrollingNode.currentScrollPosition();
    179179
    180180    if (position != m_lastScrollPosition) {
     
    206206    float visibleSize;
    207207    if (orientation == ScrollerMac:: Orientation::Vertical) {
    208         position = m_scrollingNode.scrollPosition().y();
     208        position = m_scrollingNode.currentScrollPosition().y();
    209209        totalSize = m_scrollingNode.totalContentsSize().height();
    210210        visibleSize = m_scrollingNode.scrollableAreaSize().height();
    211211    } else {
    212         position = m_scrollingNode.scrollPosition().x();
     212        position = m_scrollingNode.currentScrollPosition().x();
    213213        totalSize = m_scrollingNode.totalContentsSize().width();
    214214        visibleSize = m_scrollingNode.scrollableAreaSize().width();
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp

    r240787 r242132  
    6464}
    6565
    66 void ScrollingTreeFrameScrollingNodeRemoteMac::setScrollLayerPosition(const FloatPoint& position, const FloatRect& layoutViewport)
     66void ScrollingTreeFrameScrollingNodeRemoteMac::repositionRelatedLayers()
    6767{
    68     ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition(position, layoutViewport);
     68    ScrollingTreeFrameScrollingNodeMac::repositionRelatedLayers();
    6969
    7070    m_scrollerPair->updateValues();
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.h

    r240787 r242132  
    4646    void commitStateBeforeChildren(const WebCore::ScrollingStateNode&) override;
    4747    WebCore::ScrollingEventResult handleWheelEvent(const WebCore::PlatformWheelEvent&) override;
    48     void setScrollLayerPosition(const WebCore::FloatPoint& position, const WebCore::FloatRect& layoutViewport) override;
     48    void repositionRelatedLayers() override;
    4949
    5050    std::unique_ptr<ScrollerPairMac> m_scrollerPair;
  • trunk/Source/WebKit/UIProcess/ios/WKContentView.mm

    r242031 r242132  
    437437
    438438    WebCore::FloatRect layoutViewport = _page->computeCustomFixedPositionRect(_page->unobscuredContentRect(), _page->unobscuredContentRectRespectingInputViewBounds(), _page->customFixedPositionRect(), zoomScale, WebCore::FrameView::LayoutViewportConstraint::Unconstrained);
    439     scrollingCoordinator->viewportChangedViaDelegatedScrolling(layoutViewport, zoomScale);
     439    scrollingCoordinator->viewportChangedViaDelegatedScrolling(_page->unobscuredContentRect().location(), layoutViewport, zoomScale);
    440440
    441441    drawingArea->updateDebugIndicator();
Note: See TracChangeset for help on using the changeset viewer.