Changeset 164110 in webkit


Ignore:
Timestamp:
Feb 14, 2014 11:13:54 AM (10 years ago)
Author:
Simon Fraser
Message:

Give ScrollingTree(State)Nodes a reference to another layer, which is used for moving overflow:scroll contents around
https://bugs.webkit.org/show_bug.cgi?id=128790

Reviewed by Beth Dakin.

Have scrolling tree nodes and state nodes track another layer, the
"scrolled contents layer", for accelerated overflow:scroll.

When making ScrollingTreeScrollingNodes for overflow:scroll, the node's
layer will point to the composited element's primary layer, and its
scrolledContentsLayer to the layer that gets moved around by scrolling.

Do some other cleanup on AsyncScrollingCoordinator, removing
functions that just called through to nodes.

Source/WebCore:

  • WebCore.exp.in:
  • page/scrolling/AsyncScrollingCoordinator.cpp:

(WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
(WebCore::AsyncScrollingCoordinator::frameViewNonFastScrollableRegionChanged):
(WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange):
(WebCore::AsyncScrollingCoordinator::updateScrollingNode):
(WebCore::AsyncScrollingCoordinator::updateViewportConstrainedNode):
(WebCore::AsyncScrollingCoordinator::recomputeWheelEventHandlerCountForFrameView):

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

(WebCore::ScrollingCoordinator::updateScrollingNode):

  • page/scrolling/ScrollingStateScrollingNode.cpp:

(WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
(WebCore::ScrollingStateScrollingNode::setScrolledContentsLayer):
(WebCore::ScrollingStateScrollingNode::setCounterScrollingLayer):
(WebCore::ScrollingStateScrollingNode::setHeaderLayer):
(WebCore::ScrollingStateScrollingNode::setFooterLayer):

  • page/scrolling/ScrollingStateScrollingNode.h:
  • page/scrolling/ios/ScrollingTreeScrollingNodeIOS.h:
  • page/scrolling/ios/ScrollingTreeScrollingNodeIOS.mm:

(WebCore::ScrollingTreeScrollingNodeIOS::updateBeforeChildren):

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

(WebCore::ScrollingTreeScrollingNodeMac::updateBeforeChildren):

  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::fixedRootBackgroundLayerChanged):

Source/WebKit2:

  • UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:

(WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):

Location:
trunk/Source
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r164107 r164110  
     12014-02-13  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Give ScrollingTree(State)Nodes a reference to another layer, which is used for moving overflow:scroll contents around
     4        https://bugs.webkit.org/show_bug.cgi?id=128790
     5
     6        Reviewed by Beth Dakin.
     7
     8        Have scrolling tree nodes and state nodes track another layer, the
     9        "scrolled contents layer", for accelerated overflow:scroll.
     10       
     11        When making ScrollingTreeScrollingNodes for overflow:scroll, the node's
     12        layer will point to the composited element's primary layer, and its
     13        scrolledContentsLayer to the layer that gets moved around by scrolling.
     14       
     15        Do some other cleanup on AsyncScrollingCoordinator, removing
     16        functions that just called through to nodes.
     17
     18        * WebCore.exp.in:
     19        * page/scrolling/AsyncScrollingCoordinator.cpp:
     20        (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
     21        (WebCore::AsyncScrollingCoordinator::frameViewNonFastScrollableRegionChanged):
     22        (WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange):
     23        (WebCore::AsyncScrollingCoordinator::updateScrollingNode):
     24        (WebCore::AsyncScrollingCoordinator::updateViewportConstrainedNode):
     25        (WebCore::AsyncScrollingCoordinator::recomputeWheelEventHandlerCountForFrameView):
     26        * page/scrolling/AsyncScrollingCoordinator.h:
     27        * page/scrolling/ScrollingCoordinator.h:
     28        (WebCore::ScrollingCoordinator::updateScrollingNode):
     29        * page/scrolling/ScrollingStateScrollingNode.cpp:
     30        (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
     31        (WebCore::ScrollingStateScrollingNode::setScrolledContentsLayer):
     32        (WebCore::ScrollingStateScrollingNode::setCounterScrollingLayer):
     33        (WebCore::ScrollingStateScrollingNode::setHeaderLayer):
     34        (WebCore::ScrollingStateScrollingNode::setFooterLayer):
     35        * page/scrolling/ScrollingStateScrollingNode.h:
     36        * page/scrolling/ios/ScrollingTreeScrollingNodeIOS.h:
     37        * page/scrolling/ios/ScrollingTreeScrollingNodeIOS.mm:
     38        (WebCore::ScrollingTreeScrollingNodeIOS::updateBeforeChildren):
     39        * page/scrolling/mac/ScrollingTreeScrollingNodeMac.h:
     40        * page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
     41        (WebCore::ScrollingTreeScrollingNodeMac::updateBeforeChildren):
     42        * rendering/RenderLayerCompositor.cpp:
     43        (WebCore::RenderLayerCompositor::fixedRootBackgroundLayerChanged):
     44
    1452014-02-14  Chris Fleizach  <cfleizach@apple.com>
    246
  • trunk/Source/WebCore/WebCore.exp.in

    r163983 r164110  
    30333033__ZN7WebCore25AsyncScrollingCoordinator18syncChildPositionsERKNS_10LayoutRectE
    30343034__ZN7WebCore25AsyncScrollingCoordinator19detachFromStateTreeEy
    3035 __ZN7WebCore25AsyncScrollingCoordinator19updateScrollingNodeEyPNS_13GraphicsLayerES2_
     3035__ZN7WebCore25AsyncScrollingCoordinator19updateScrollingNodeEyPNS_13GraphicsLayerES2_S2_
    30363036__ZN7WebCore25AsyncScrollingCoordinator22frameViewLayoutUpdatedEPNS_9FrameViewE
    30373037__ZNK7WebCore25AsyncScrollingCoordinator24scrollingStateTreeAsTextEv
     
    30563056__ZN7WebCore27ScrollingStateScrollingNode20setTotalContentsSizeERKNS_7IntSizeE
    30573057__ZN7WebCore27ScrollingStateScrollingNode24setCounterScrollingLayerERKNS_19LayerRepresentationE
     3058__ZN7WebCore27ScrollingStateScrollingNode24setScrolledContentsLayerERKNS_19LayerRepresentationE
    30583059__ZN7WebCore27ScrollingStateScrollingNode25setWheelEventHandlerCountEj
    30593060__ZN7WebCore27ScrollingStateScrollingNode26setNonFastScrollableRegionERKNS_6RegionE
  • trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp

    r163516 r164110  
    7070    // all scrollable areas, such as subframes, overflow divs and list boxes. We need to do this even if the
    7171    // frame view whose layout was updated is not the main frame.
    72     Region nonFastScrollableRegion = computeNonFastScrollableRegion(&m_page->mainFrame(), IntPoint());
    73 
    7472    // In the future, we may want to have the ability to set non-fast scrolling regions for more than
    7573    // just the root node. But right now, this concept only applies to the root.
    76     setNonFastScrollableRegionForNode(nonFastScrollableRegion, m_scrollingStateTree->rootStateNode());
     74    m_scrollingStateTree->rootStateNode()->setNonFastScrollableRegion(computeNonFastScrollableRegion(&m_page->mainFrame(), IntPoint()));
    7775
    7876    if (!coordinatesScrollingForFrameView(frameView))
     
    111109        return;
    112110
    113     Region nonFastScrollableRegion = computeNonFastScrollableRegion(&m_page->mainFrame(), IntPoint());
    114     setNonFastScrollableRegionForNode(nonFastScrollableRegion, m_scrollingStateTree->rootStateNode());
     111    m_scrollingStateTree->rootStateNode()->setNonFastScrollableRegion(computeNonFastScrollableRegion(&m_page->mainFrame(), IntPoint()));
    115112}
    116113
     
    130127
    131128    ScrollingStateScrollingNode* node = toScrollingStateScrollingNode(m_scrollingStateTree->stateNodeForID(frameView->scrollLayerID()));
    132     setScrollLayerForNode(scrollLayerForFrameView(frameView), node);
    133     setCounterScrollingLayerForNode(counterScrollingLayerForFrameView(frameView), node);
    134     setHeaderLayerForNode(headerLayerForFrameView(frameView), node);
    135     setFooterLayerForNode(footerLayerForFrameView(frameView), node);
    136     setScrollBehaviorForFixedElementsForNode(frameView->scrollBehaviorForFixedElements(), node);
     129    node->setLayer(scrollLayerForFrameView(frameView));
     130    node->setCounterScrollingLayer(counterScrollingLayerForFrameView(frameView));
     131    node->setHeaderLayer(headerLayerForFrameView(frameView));
     132    node->setFooterLayer(footerLayerForFrameView(frameView));
     133    node->setScrollBehaviorForFixedElements(frameView->scrollBehaviorForFixedElements());
    137134}
    138135
     
    291288}
    292289
    293 void AsyncScrollingCoordinator::updateScrollingNode(ScrollingNodeID nodeID, GraphicsLayer* scrollLayer, GraphicsLayer* counterScrollingLayer)
     290void AsyncScrollingCoordinator::updateScrollingNode(ScrollingNodeID nodeID, GraphicsLayer* layer, GraphicsLayer* scrolledContentsLayer, GraphicsLayer* counterScrollingLayer)
    294291{
    295292    ScrollingStateScrollingNode* node = toScrollingStateScrollingNode(m_scrollingStateTree->stateNodeForID(nodeID));
     
    298295        return;
    299296
    300     node->setLayer(scrollLayer);
     297    node->setLayer(layer);
     298    node->setScrolledContentsLayer(scrolledContentsLayer);
    301299    node->setCounterScrollingLayer(counterScrollingLayer);
    302300}
     
    313311    case ViewportConstraints::FixedPositionConstraint: {
    314312        ScrollingStateFixedNode* fixedNode = toScrollingStateFixedNode(node);
    315         setScrollLayerForNode(graphicsLayer, fixedNode);
     313        fixedNode->setLayer(graphicsLayer);
    316314        fixedNode->updateConstraints((const FixedPositionViewportConstraints&)constraints);
    317315        break;
     
    319317    case ViewportConstraints::StickyPositionConstraint: {
    320318        ScrollingStateStickyNode* stickyNode = toScrollingStateStickyNode(node);
    321         setScrollLayerForNode(graphicsLayer, stickyNode);
     319        stickyNode->setLayer(graphicsLayer);
    322320        stickyNode->updateConstraints((const StickyPositionViewportConstraints&)constraints);
    323321        break;
    324322    }
    325323    }
    326 }
    327 
    328 void AsyncScrollingCoordinator::setScrollLayerForNode(GraphicsLayer* scrollLayer, ScrollingStateNode* node)
    329 {
    330     node->setLayer(scrollLayer);
    331 }
    332 
    333 void AsyncScrollingCoordinator::setCounterScrollingLayerForNode(GraphicsLayer* layer, ScrollingStateScrollingNode* node)
    334 {
    335     node->setCounterScrollingLayer(layer);
    336 }
    337 
    338 void AsyncScrollingCoordinator::setHeaderLayerForNode(GraphicsLayer* headerLayer, ScrollingStateScrollingNode* node)
    339 {
    340     // Headers and footers are only supported on the root node.
    341     ASSERT(node == m_scrollingStateTree->rootStateNode());
    342     node->setHeaderLayer(headerLayer);
    343 }
    344 
    345 void AsyncScrollingCoordinator::setFooterLayerForNode(GraphicsLayer* footerLayer, ScrollingStateScrollingNode* node)
    346 {
    347     // Headers and footers are only supported on the root node.
    348     ASSERT(node == m_scrollingStateTree->rootStateNode());
    349     node->setFooterLayer(footerLayer);
    350 }
    351 
    352 void AsyncScrollingCoordinator::setNonFastScrollableRegionForNode(const Region& region, ScrollingStateScrollingNode* node)
    353 {
    354     node->setNonFastScrollableRegion(region);
    355 }
    356 
    357 void AsyncScrollingCoordinator::setWheelEventHandlerCountForNode(unsigned wheelEventHandlerCount, ScrollingStateScrollingNode* node)
    358 {
    359     node->setWheelEventHandlerCount(wheelEventHandlerCount);
    360 }
    361 
    362 void AsyncScrollingCoordinator::setScrollBehaviorForFixedElementsForNode(ScrollBehaviorForFixedElements behaviorForFixed, ScrollingStateScrollingNode* node)
    363 {
    364     node->setScrollBehaviorForFixedElements(behaviorForFixed);
    365324}
    366325
     
    404363    if (!node)
    405364        return;
    406     setWheelEventHandlerCountForNode(computeCurrentWheelEventHandlerCount(), node);
     365    node->setWheelEventHandlerCount(computeCurrentWheelEventHandlerCount());
    407366}
    408367
  • trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h

    r163516 r164110  
    8888
    8989    virtual void updateViewportConstrainedNode(ScrollingNodeID, const ViewportConstraints&, GraphicsLayer*) override;
    90     virtual void updateScrollingNode(ScrollingNodeID, GraphicsLayer* scrollLayer, GraphicsLayer* counterScrollingLayer) override;
     90    virtual void updateScrollingNode(ScrollingNodeID, GraphicsLayer*, GraphicsLayer* scrolledContentsLayer, GraphicsLayer* counterScrollingLayer) override;
    9191    virtual String scrollingStateTreeAsText() const override;
    9292    virtual bool isRubberBandInProgress() const override;
     
    104104    void updateMainFrameScrollLayerPosition();
    105105
    106     void setScrollLayerForNode(GraphicsLayer*, ScrollingStateNode*);
    107     void setCounterScrollingLayerForNode(GraphicsLayer*, ScrollingStateScrollingNode*);
    108     void setHeaderLayerForNode(GraphicsLayer*, ScrollingStateScrollingNode*);
    109     void setFooterLayerForNode(GraphicsLayer*, ScrollingStateScrollingNode*);
    110     void setNonFastScrollableRegionForNode(const Region&, ScrollingStateScrollingNode*);
    111     void setWheelEventHandlerCountForNode(unsigned, ScrollingStateScrollingNode*);
    112     void setScrollBehaviorForFixedElementsForNode(ScrollBehaviorForFixedElements, ScrollingStateScrollingNode*);
    113106    // FIXME: move somewhere else?
    114107    void setScrollbarPaintersFromScrollbarsForNode(Scrollbar* verticalScrollbar, Scrollbar* horizontalScrollbar, ScrollingStateScrollingNode*);
  • trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h

    r163725 r164110  
    153153    virtual void clearStateTree() { }
    154154    virtual void updateViewportConstrainedNode(ScrollingNodeID, const ViewportConstraints&, GraphicsLayer*) { }
    155     virtual void updateScrollingNode(ScrollingNodeID, GraphicsLayer* /*scrollLayer*/, GraphicsLayer* /*counterScrollingLayer*/) { }
     155    virtual void updateScrollingNode(ScrollingNodeID, GraphicsLayer* /*scrollLayer*/, GraphicsLayer* /*scrolledContentsLayer*/, GraphicsLayer* /*counterScrollingLayer*/) { }
    156156    virtual void syncChildPositions(const LayoutRect&) { }
    157157    virtual String scrollingStateTreeAsText() const;
  • trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp

    r163677 r164110  
    7777    , m_requestedScrollPositionRepresentsProgrammaticScroll(stateNode.requestedScrollPositionRepresentsProgrammaticScroll())
    7878{
     79    if (hasChangedProperty(ScrolledContentsLayer))
     80        setScrolledContentsLayer(stateNode.scrolledContentsLayer().toRepresentation(adoptiveTree.preferredLayerRepresentation()));
     81
    7982    if (hasChangedProperty(CounterScrollingLayer))
    8083        setCounterScrollingLayer(stateNode.counterScrollingLayer().toRepresentation(adoptiveTree.preferredLayerRepresentation()));
     
    212215}
    213216
     217void ScrollingStateScrollingNode::setScrolledContentsLayer(const LayerRepresentation& layerRepresentation)
     218{
     219    if (layerRepresentation == m_scrolledContentsLayer)
     220        return;
     221   
     222    m_scrolledContentsLayer = layerRepresentation;
     223    setPropertyChanged(ScrolledContentsLayer);
     224}
     225
    214226void ScrollingStateScrollingNode::setCounterScrollingLayer(const LayerRepresentation& layerRepresentation)
    215227{
     
    218230   
    219231    m_counterScrollingLayer = layerRepresentation;
    220 
    221232    setPropertyChanged(CounterScrollingLayer);
    222233}
     
    228239   
    229240    m_headerLayer = layerRepresentation;
    230 
    231241    setPropertyChanged(HeaderLayer);
    232242}
     
    239249   
    240250    m_footerLayer = layerRepresentation;
    241 
    242251    setPropertyChanged(FooterLayer);
    243252}
  • trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h

    r163677 r164110  
    6161        ReasonsForSynchronousScrolling,
    6262        RequestedScrollPosition,
     63        ScrolledContentsLayer,
    6364        CounterScrollingLayer,
    6465        HeaderHeight,
     
    110111    void setFooterHeight(int);
    111112
     113    // This is a layer with the contents that move (only used for overflow:scroll).
     114    const LayerRepresentation& scrolledContentsLayer() const { return m_scrolledContentsLayer; }
     115    void setScrolledContentsLayer(const LayerRepresentation&);
     116
    112117    // This is a layer moved in the opposite direction to scrolling, for example for background-attachment:fixed
    113118    const LayerRepresentation& counterScrollingLayer() const { return m_counterScrollingLayer; }
     
    134139    ScrollingStateScrollingNode(const ScrollingStateScrollingNode&, ScrollingStateTree&);
    135140
     141    LayerRepresentation m_scrolledContentsLayer;
    136142    LayerRepresentation m_counterScrollingLayer;
    137143    LayerRepresentation m_headerLayer;
  • trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeScrollingNodeIOS.h

    r163231 r164110  
    6262
    6363    RetainPtr<CALayer> m_scrollLayer;
     64    RetainPtr<CALayer> m_scrolledContentsLayer;
    6465    RetainPtr<CALayer> m_counterScrollingLayer;
    6566    RetainPtr<CALayer> m_headerLayer;
  • trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeScrollingNodeIOS.mm

    r163231 r164110  
    6363        m_scrollLayer = scrollingStateNode.layer();
    6464
     65    if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrolledContentsLayer))
     66        m_scrolledContentsLayer = scrollingStateNode.scrolledContentsLayer();
     67
    6568    if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::CounterScrollingLayer))
    6669        m_counterScrollingLayer = scrollingStateNode.counterScrollingLayer();
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.h

    r163231 r164110  
    8686
    8787    RetainPtr<CALayer> m_scrollLayer;
     88    RetainPtr<CALayer> m_scrolledContentsLayer;
    8889    RetainPtr<CALayer> m_counterScrollingLayer;
    8990    RetainPtr<CALayer> m_headerLayer;
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm

    r163472 r164110  
    7979        m_scrollLayer = scrollingStateNode.layer();
    8080
     81    if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrolledContentsLayer))
     82        m_scrolledContentsLayer = scrollingStateNode.scrolledContentsLayer();
     83
    8184    if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::CounterScrollingLayer))
    8285        m_counterScrollingLayer = scrollingStateNode.counterScrollingLayer();
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r163955 r164110  
    15671567            return;
    15681568
    1569         scrollingCoordinator->updateScrollingNode(renderViewBacking->scrollLayerID(), scrollLayer(), fixedRootBackgroundLayer());
     1569        scrollingCoordinator->updateScrollingNode(renderViewBacking->scrollLayerID(), scrollLayer(), nullptr, fixedRootBackgroundLayer());
    15701570    }
    15711571}
  • trunk/Source/WebKit2/ChangeLog

    r164109 r164110  
     12014-02-13  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Give ScrollingTree(State)Nodes a reference to another layer, which is used for moving overflow:scroll contents around
     4        https://bugs.webkit.org/show_bug.cgi?id=128790
     5
     6        Reviewed by Beth Dakin.
     7
     8        Have scrolling tree nodes and state nodes track another layer, the
     9        "scrolled contents layer", for accelerated overflow:scroll.
     10       
     11        When making ScrollingTreeScrollingNodes for overflow:scroll, the node's
     12        layer will point to the composited element's primary layer, and its
     13        scrolledContentsLayer to the layer that gets moved around by scrolling.
     14       
     15        Do some other cleanup on AsyncScrollingCoordinator, removing
     16        functions that just called through to nodes.
     17
     18        * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
     19        (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
     20
    1212014-02-14  Anders Carlsson  <andersca@apple.com>
    222
  • trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp

    r163959 r164110  
    101101                scrollingStateNode->setLayer(layerTreeHost.getLayer(scrollingStateNode->layer()));
    102102
     103            if (scrollingStateNode->hasChangedProperty(ScrollingStateScrollingNode::ScrolledContentsLayer))
     104                scrollingStateNode->setScrolledContentsLayer(layerTreeHost.getLayer(scrollingStateNode->scrolledContentsLayer()));
     105
    103106            if (scrollingStateNode->hasChangedProperty(ScrollingStateScrollingNode::CounterScrollingLayer))
    104107                scrollingStateNode->setCounterScrollingLayer(layerTreeHost.getLayer(scrollingStateNode->counterScrollingLayer()));
Note: See TracChangeset for help on using the changeset viewer.