Changeset 238885 in webkit


Ignore:
Timestamp:
Dec 4, 2018 7:58:01 PM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Always pass scrollingGeometry to update*ScrollingNode functions
https://bugs.webkit.org/show_bug.cgi?id=192358

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

Currently, the scrollingGeometry parameter of updateOverflowScrollingNode is always used
while the one of updateFrameScrollingNode is never used. Both of them are passed as possibly
null pointers. This commit makes things more consistent by making the parameter a reference
and explicitly setting the scrollingGeometry of updateFrameScrollingNode. This will help
other efforts (such as support for macOS/iOS asynchronous scrolling of overflow nodes /
subframes or for CSS overscroll-behavior) for which new data members have to be passed to the
scrolling nodes.

No new tests, no behavior changes.

  • page/scrolling/AsyncScrollingCoordinator.cpp:

(WebCore::AsyncScrollingCoordinator::updateFrameScrollingNode):
(WebCore::AsyncScrollingCoordinator::updateOverflowScrollingNode):

  • page/scrolling/AsyncScrollingCoordinator.h:
  • page/scrolling/ScrollingCoordinator.h:

(WebCore::ScrollingCoordinator::updateFrameScrollingNode):
(WebCore::ScrollingCoordinator::updateOverflowScrollingNode):

  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::updateScrollCoordinationForThisFrame):
(WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r238880 r238885  
     12018-12-04  Frederic Wang  <fwang@igalia.com>
     2
     3        Always pass scrollingGeometry to update*ScrollingNode functions
     4        https://bugs.webkit.org/show_bug.cgi?id=192358
     5
     6        Reviewed by Simon Fraser.
     7
     8        Currently, the scrollingGeometry parameter of updateOverflowScrollingNode is always used
     9        while the one of updateFrameScrollingNode is never used. Both of them are passed as possibly
     10        null pointers. This commit makes things more consistent by making the parameter a reference
     11        and explicitly setting the scrollingGeometry of updateFrameScrollingNode. This will help
     12        other efforts (such as support for macOS/iOS asynchronous scrolling of overflow nodes /
     13        subframes or for CSS overscroll-behavior) for which new data members have to be passed to the
     14        scrolling nodes.
     15
     16        No new tests, no behavior changes.
     17
     18        * page/scrolling/AsyncScrollingCoordinator.cpp:
     19        (WebCore::AsyncScrollingCoordinator::updateFrameScrollingNode):
     20        (WebCore::AsyncScrollingCoordinator::updateOverflowScrollingNode):
     21        * page/scrolling/AsyncScrollingCoordinator.h:
     22        * page/scrolling/ScrollingCoordinator.h:
     23        (WebCore::ScrollingCoordinator::updateFrameScrollingNode):
     24        (WebCore::ScrollingCoordinator::updateOverflowScrollingNode):
     25        * rendering/RenderLayerCompositor.cpp:
     26        (WebCore::RenderLayerCompositor::updateScrollCoordinationForThisFrame):
     27        (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
     28
    1292018-12-04  Ryosuke Niwa  <rniwa@webkit.org>
    230
  • trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp

    r238690 r238885  
    513513}
    514514
    515 void AsyncScrollingCoordinator::updateFrameScrollingNode(ScrollingNodeID nodeID, GraphicsLayer* layer, GraphicsLayer* scrolledContentsLayer, GraphicsLayer* counterScrollingLayer, GraphicsLayer* insetClipLayer, const ScrollingGeometry* scrollingGeometry)
     515void AsyncScrollingCoordinator::updateFrameScrollingNode(ScrollingNodeID nodeID, GraphicsLayer* layer, GraphicsLayer* scrolledContentsLayer, GraphicsLayer* counterScrollingLayer, GraphicsLayer* insetClipLayer, const ScrollingGeometry& scrollingGeometry)
    516516{
    517517    auto* node = downcast<ScrollingStateFrameScrollingNode>(m_scrollingStateTree->stateNodeForID(nodeID));
     
    524524    node->setScrolledContentsLayer(scrolledContentsLayer);
    525525    node->setCounterScrollingLayer(counterScrollingLayer);
    526 
    527     if (scrollingGeometry) {
    528         node->setParentRelativeScrollableRect(scrollingGeometry->parentRelativeScrollableRect);
    529         node->setScrollOrigin(scrollingGeometry->scrollOrigin);
    530         node->setScrollPosition(scrollingGeometry->scrollPosition);
    531         node->setTotalContentsSize(scrollingGeometry->contentSize);
    532         node->setReachableContentsSize(scrollingGeometry->reachableContentSize);
    533         node->setScrollableAreaSize(scrollingGeometry->scrollableAreaSize);
    534     }
    535 }
    536    
    537 void AsyncScrollingCoordinator::updateOverflowScrollingNode(ScrollingNodeID nodeID, GraphicsLayer* layer, GraphicsLayer* scrolledContentsLayer, const ScrollingGeometry* scrollingGeometry)
     526    node->setParentRelativeScrollableRect(scrollingGeometry.parentRelativeScrollableRect);
     527    node->setScrollOrigin(scrollingGeometry.scrollOrigin);
     528    node->setScrollPosition(scrollingGeometry.scrollPosition);
     529    node->setTotalContentsSize(scrollingGeometry.contentSize);
     530    node->setReachableContentsSize(scrollingGeometry.reachableContentSize);
     531    node->setScrollableAreaSize(scrollingGeometry.scrollableAreaSize);
     532}
     533   
     534void AsyncScrollingCoordinator::updateOverflowScrollingNode(ScrollingNodeID nodeID, GraphicsLayer* layer, GraphicsLayer* scrolledContentsLayer, const ScrollingGeometry& scrollingGeometry)
    538535{
    539536    auto* node = downcast<ScrollingStateOverflowScrollingNode>(m_scrollingStateTree->stateNodeForID(nodeID));
     
    544541    node->setLayer(layer);
    545542    node->setScrolledContentsLayer(scrolledContentsLayer);
    546    
    547     if (scrollingGeometry) {
    548         node->setParentRelativeScrollableRect(scrollingGeometry->parentRelativeScrollableRect);
    549         node->setScrollOrigin(scrollingGeometry->scrollOrigin);
    550         node->setScrollPosition(scrollingGeometry->scrollPosition);
    551         node->setTotalContentsSize(scrollingGeometry->contentSize);
    552         node->setReachableContentsSize(scrollingGeometry->reachableContentSize);
    553         node->setScrollableAreaSize(scrollingGeometry->scrollableAreaSize);
     543    node->setParentRelativeScrollableRect(scrollingGeometry.parentRelativeScrollableRect);
     544    node->setScrollOrigin(scrollingGeometry.scrollOrigin);
     545    node->setScrollPosition(scrollingGeometry.scrollPosition);
     546    node->setTotalContentsSize(scrollingGeometry.contentSize);
     547    node->setReachableContentsSize(scrollingGeometry.reachableContentSize);
     548    node->setScrollableAreaSize(scrollingGeometry.scrollableAreaSize);
    554549#if ENABLE(CSS_SCROLL_SNAP)
    555         setStateScrollingNodeSnapOffsetsAsFloat(*node, ScrollEventAxis::Horizontal, &scrollingGeometry->horizontalSnapOffsets, &scrollingGeometry->horizontalSnapOffsetRanges, m_page->deviceScaleFactor());
    556         setStateScrollingNodeSnapOffsetsAsFloat(*node, ScrollEventAxis::Vertical, &scrollingGeometry->verticalSnapOffsets, &scrollingGeometry->verticalSnapOffsetRanges, m_page->deviceScaleFactor());
    557         node->setCurrentHorizontalSnapPointIndex(scrollingGeometry->currentHorizontalSnapPointIndex);
    558         node->setCurrentVerticalSnapPointIndex(scrollingGeometry->currentVerticalSnapPointIndex);
    559 #endif
    560     }
     550    setStateScrollingNodeSnapOffsetsAsFloat(*node, ScrollEventAxis::Horizontal, &scrollingGeometry.horizontalSnapOffsets, &scrollingGeometry.horizontalSnapOffsetRanges, m_page->deviceScaleFactor());
     551    setStateScrollingNodeSnapOffsetsAsFloat(*node, ScrollEventAxis::Vertical, &scrollingGeometry.verticalSnapOffsets, &scrollingGeometry.verticalSnapOffsetRanges, m_page->deviceScaleFactor());
     552    node->setCurrentHorizontalSnapPointIndex(scrollingGeometry.currentHorizontalSnapPointIndex);
     553    node->setCurrentVerticalSnapPointIndex(scrollingGeometry.currentVerticalSnapPointIndex);
     554#endif
    561555}
    562556
  • trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h

    r238690 r238885  
    105105    WEBCORE_EXPORT void updateNodeViewportConstraints(ScrollingNodeID, const ViewportConstraints&) override;
    106106   
    107     WEBCORE_EXPORT void updateFrameScrollingNode(ScrollingNodeID, GraphicsLayer* scrollLayer, GraphicsLayer* scrolledContentsLayer, GraphicsLayer* counterScrollingLayer, GraphicsLayer* insetClipLayer, const ScrollingGeometry* = nullptr) override;
    108     WEBCORE_EXPORT void updateOverflowScrollingNode(ScrollingNodeID, GraphicsLayer* scrollLayer, GraphicsLayer* scrolledContentsLayer, const ScrollingGeometry* = nullptr) override;
     107    WEBCORE_EXPORT void updateFrameScrollingNode(ScrollingNodeID, GraphicsLayer* scrollLayer, GraphicsLayer* scrolledContentsLayer, GraphicsLayer* counterScrollingLayer, GraphicsLayer* insetClipLayer, const ScrollingGeometry&) override;
     108    WEBCORE_EXPORT void updateOverflowScrollingNode(ScrollingNodeID, GraphicsLayer* scrollLayer, GraphicsLayer* scrolledContentsLayer, const ScrollingGeometry&) override;
    109109   
    110110    WEBCORE_EXPORT void reconcileScrollingState(FrameView&, const FloatPoint&, const LayoutViewportOriginOrOverrideRect&, bool programmaticScroll, ViewportRectStability, ScrollingLayerPositionAction) override;
  • trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h

    r238690 r238885  
    190190    };
    191191
    192     virtual void updateFrameScrollingNode(ScrollingNodeID, GraphicsLayer* /*scrollLayer*/, GraphicsLayer* /*scrolledContentsLayer*/, GraphicsLayer* /*counterScrollingLayer*/, GraphicsLayer* /*insetClipLayer*/, const ScrollingGeometry* = nullptr) { }
    193     virtual void updateOverflowScrollingNode(ScrollingNodeID, GraphicsLayer* /*scrollLayer*/, GraphicsLayer* /*scrolledContentsLayer*/, const ScrollingGeometry* = nullptr) { }
     192    virtual void updateFrameScrollingNode(ScrollingNodeID, GraphicsLayer* /*scrollLayer*/, GraphicsLayer* /*scrolledContentsLayer*/, GraphicsLayer* /*counterScrollingLayer*/, GraphicsLayer* /*insetClipLayer*/, const ScrollingGeometry&) { }
     193    virtual void updateOverflowScrollingNode(ScrollingNodeID, GraphicsLayer* /*scrollLayer*/, GraphicsLayer* /*scrolledContentsLayer*/, const ScrollingGeometry&) { }
    194194    virtual void reconcileViewportConstrainedLayerPositions(ScrollingNodeID, const LayoutRect&, ScrollingLayerPositionAction) { }
    195195    virtual String scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior = ScrollingStateTreeAsTextBehaviorNormal) const;
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r238876 r238885  
    38703870{
    38713871    auto* scrollingCoordinator = this->scrollingCoordinator();
    3872     ASSERT(scrollingCoordinator->coordinatesScrollingForFrameView(m_renderView.frameView()));
     3872    FrameView& frameView = m_renderView.frameView();
     3873    ASSERT(scrollingCoordinator->coordinatesScrollingForFrameView(frameView));
    38733874
    38743875    ScrollingNodeID nodeID = attachScrollingNode(*m_renderView.layer(), m_renderView.frame().isMainFrame() ? MainFrameScrollingNode : SubframeScrollingNode, parentNodeID);
    3875     scrollingCoordinator->updateFrameScrollingNode(nodeID, m_scrollLayer.get(), m_rootContentLayer.get(), fixedRootBackgroundLayer(), clipLayer());
     3876    ScrollingCoordinator::ScrollingGeometry scrollingGeometry;
     3877    // FIXME(https://webkit.org/b/172917): Pass parentRelativeScrollableRect?
     3878    scrollingGeometry.scrollOrigin = frameView.scrollOrigin();
     3879    scrollingGeometry.scrollableAreaSize = frameView.visibleContentRect().size();
     3880    scrollingGeometry.contentSize = frameView.totalContentsSize();
     3881    scrollingGeometry.reachableContentSize = frameView.totalContentsSize();
     3882#if ENABLE(CSS_SCROLL_SNAP)
     3883    frameView.updateSnapOffsets();
     3884    scrollingCoordinator->updateScrollSnapPropertiesWithFrameView(frameView);
     3885#endif
     3886    scrollingCoordinator->updateFrameScrollingNode(nodeID, m_scrollLayer.get(), m_rootContentLayer.get(), fixedRootBackgroundLayer(), clipLayer(), scrollingGeometry);
    38763887}
    38773888
     
    39523963
    39533964            ScrollingCoordinator::ScrollingGeometry scrollingGeometry;
     3965            // FIXME(https://webkit.org/b/172917): Pass parentRelativeScrollableRect?
    39543966            scrollingGeometry.scrollOrigin = layer.scrollOrigin();
    39553967            scrollingGeometry.scrollPosition = layer.scrollPosition();
     
    39723984            LOG(Compositing, "Registering Scrolling scrolling node %" PRIu64 " (layer %" PRIu64 ") as child of %" PRIu64, nodeID, backing->graphicsLayer()->primaryLayerID(), parentNodeID);
    39733985
    3974             scrollingCoordinator->updateOverflowScrollingNode(nodeID, backing->scrollingLayer(), backing->scrollingContentsLayer(), &scrollingGeometry);
     3986            scrollingCoordinator->updateOverflowScrollingNode(nodeID, backing->scrollingLayer(), backing->scrollingContentsLayer(), scrollingGeometry);
    39753987        }
    39763988    } else
Note: See TracChangeset for help on using the changeset viewer.