Changeset 238690 in webkit


Ignore:
Timestamp:
Nov 29, 2018 1:22:02 PM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Make reconcileViewportConstrainedLayerPositions start from a specified scrolling node
https://bugs.webkit.org/show_bug.cgi?id=180002

Patch by Frederic Wang <fwang@igalia.com> on 2018-11-29
Reviewed by Simon Fraser.

For non-programmatic scrolling of frames, AsyncScrollingCoordinator::reconcileScrollingState
currently always call reconcileViewportConstrainedLayerPositions for the main frame
since async subframe scrolling is not supported yet (bug 171667 and bug 149264). This
function in turn calls reconcileLayerPositionForViewportRect on the whole scrolling tree to
readjust position of fixed/sticky descendants. This patch refactors a bit the code so that
the operation is actually only applied to the descendants of the frame's scrolling node,
which would mean a small optimization when subframe are asynchronously scrollable. The code
is already covered by reconcile-layer-position-recursive.html.

No new tests, behavior unchanged and already covered by existing tests.

  • page/scrolling/AsyncScrollingCoordinator.cpp:

(WebCore::AsyncScrollingCoordinator::reconcileScrollingState): Pass the frame's scrolling
node id.
(WebCore::AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions): Start
reconciliation from the specified scrolling node and log its ID.

  • page/scrolling/AsyncScrollingCoordinator.h: Add ScrollingNodeID parameter.
  • page/scrolling/ScrollingCoordinator.h:

(WebCore::ScrollingCoordinator::reconcileViewportConstrainedLayerPositions): Ditto.

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r238689 r238690  
     12018-11-29  Frederic Wang  <fwang@igalia.com>
     2
     3        Make reconcileViewportConstrainedLayerPositions start from a specified scrolling node
     4        https://bugs.webkit.org/show_bug.cgi?id=180002
     5
     6        Reviewed by Simon Fraser.
     7
     8        For non-programmatic scrolling of frames, AsyncScrollingCoordinator::reconcileScrollingState
     9        currently always call reconcileViewportConstrainedLayerPositions for the main frame
     10        since async subframe scrolling is not supported yet (bug 171667 and bug 149264). This
     11        function in turn calls reconcileLayerPositionForViewportRect on the whole scrolling tree to
     12        readjust position of fixed/sticky descendants. This patch refactors a bit the code so that
     13        the operation is actually only applied to the descendants of the frame's scrolling node,
     14        which would mean a small optimization when subframe are asynchronously scrollable. The code
     15        is already covered by reconcile-layer-position-recursive.html.
     16
     17        No new tests, behavior unchanged and already covered by existing tests.
     18
     19        * page/scrolling/AsyncScrollingCoordinator.cpp:
     20        (WebCore::AsyncScrollingCoordinator::reconcileScrollingState): Pass the frame's scrolling
     21        node id.
     22        (WebCore::AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions): Start
     23        reconciliation from the specified scrolling node and log its ID.
     24        * page/scrolling/AsyncScrollingCoordinator.h: Add ScrollingNodeID parameter.
     25        * page/scrolling/ScrollingCoordinator.h:
     26        (WebCore::ScrollingCoordinator::reconcileViewportConstrainedLayerPositions): Ditto.
     27
    1282018-11-29  Zalan Bujtas  <zalan@apple.com>
    229
  • trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp

    r238665 r238690  
    399399
    400400    if (!programmaticScroll && scrollingLayerPositionAction != ScrollingLayerPositionAction::Set) {
     401        auto scrollingNodeID = frameView.scrollLayerID();
    401402        if (viewportRectStability == ViewportRectStability::Stable)
    402             reconcileViewportConstrainedLayerPositions(frameView.rectForFixedPositionLayout(), scrollingLayerPositionAction);
     403            reconcileViewportConstrainedLayerPositions(scrollingNodeID, frameView.rectForFixedPositionLayout(), scrollingLayerPositionAction);
    403404        else if (layoutViewportRect)
    404             reconcileViewportConstrainedLayerPositions(LayoutRect(layoutViewportRect.value()), scrollingLayerPositionAction);
     405            reconcileViewportConstrainedLayerPositions(scrollingNodeID, LayoutRect(layoutViewportRect.value()), scrollingLayerPositionAction);
    405406    }
    406407
     
    489490}
    490491
    491 void AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions(const LayoutRect& viewportRect, ScrollingLayerPositionAction action)
    492 {
    493     if (!m_scrollingStateTree->rootStateNode())
    494         return;
    495 
    496     LOG_WITH_STREAM(Scrolling, stream << getCurrentProcessID() << " AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions for viewport rect " << viewportRect);
    497 
    498     m_scrollingStateTree->rootStateNode()->reconcileLayerPositionForViewportRect(viewportRect, action);
     492void AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions(ScrollingNodeID scrollingNodeID, const LayoutRect& viewportRect, ScrollingLayerPositionAction action)
     493{
     494    auto* scrollingNode = m_scrollingStateTree->stateNodeForID(scrollingNodeID);
     495    if (!scrollingNode)
     496        return;
     497
     498    LOG_WITH_STREAM(Scrolling, stream << getCurrentProcessID() << " AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions for viewport rect " << viewportRect << " and node " << scrollingNodeID);
     499
     500    scrollingNode->reconcileLayerPositionForViewportRect(viewportRect, action);
    499501}
    500502
  • trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h

    r219668 r238690  
    117117#endif
    118118
    119     WEBCORE_EXPORT void reconcileViewportConstrainedLayerPositions(const LayoutRect& viewportRect, ScrollingLayerPositionAction) override;
     119    WEBCORE_EXPORT void reconcileViewportConstrainedLayerPositions(ScrollingNodeID, const LayoutRect& viewportRect, ScrollingLayerPositionAction) override;
    120120    WEBCORE_EXPORT void scrollableAreaScrollbarLayerDidChange(ScrollableArea&, ScrollbarOrientation) override;
    121121
  • trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h

    r238665 r238690  
    192192    virtual void updateFrameScrollingNode(ScrollingNodeID, GraphicsLayer* /*scrollLayer*/, GraphicsLayer* /*scrolledContentsLayer*/, GraphicsLayer* /*counterScrollingLayer*/, GraphicsLayer* /*insetClipLayer*/, const ScrollingGeometry* = nullptr) { }
    193193    virtual void updateOverflowScrollingNode(ScrollingNodeID, GraphicsLayer* /*scrollLayer*/, GraphicsLayer* /*scrolledContentsLayer*/, const ScrollingGeometry* = nullptr) { }
    194     virtual void reconcileViewportConstrainedLayerPositions(const LayoutRect&, ScrollingLayerPositionAction) { }
     194    virtual void reconcileViewportConstrainedLayerPositions(ScrollingNodeID, const LayoutRect&, ScrollingLayerPositionAction) { }
    195195    virtual String scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior = ScrollingStateTreeAsTextBehaviorNormal) const;
    196196    virtual bool isRubberBandInProgress() const { return false; }
Note: See TracChangeset for help on using the changeset viewer.