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

Changeset 242997 in webkit


Ignore:
Timestamp:
Mar 15, 2019, 9:26:09 AM (7 years ago)
Author:
Simon Fraser
Message:

[Async overflow Scrolling] Update positioned node layers when overflows are scrolled
https://bugs.webkit.org/show_bug.cgi?id=195733
rdar://problem/11642295

Reviewed by Antti Koivisto.

Source/WebCore:

Make ScrollingTree positioned nodes in the two cases where we need them, as
detected by RenderLayerCompositor::computeCoordinatedPositioningForLayer().

For "Moves" layers we know that the overflow is not in the z-order ancestor chain,
so ScrollingTree needs a map of overflow node -> affected positioned nodes which
notifyRelatedNodesAfterScrollPositionChange() uses to find nodes to update after
a scroll. Computing these dependent nodes in RenderLayerCompositor() would require
correct dependency analysis between an overflow layers and "positioned" layers which
is hard. It's easier to have "positioned" layers figure out which overflow nodes
affect them, then compute the inverse relationship when the scrolling tree is updated
which happens in ScrollingTreePositionedNode::commitStateBeforeChildren().

Tests: scrollingcoordinator/ios/absolute-layer-should-not-move-with-scroll.html

scrollingcoordinator/ios/relative-layer-should-move-with-scroll.html

  • page/scrolling/ScrollingTree.cpp:

(WebCore::ScrollingTree::commitTreeState):
(WebCore::ScrollingTree::applyLayerPositions):
(WebCore::ScrollingTree::notifyRelatedNodesAfterScrollPositionChange):
(WebCore::ScrollingTree::scrollingTreeAsText):

  • page/scrolling/ScrollingTree.h:

(WebCore::ScrollingTree::overflowRelatedNodes):

  • page/scrolling/ScrollingTreeOverflowScrollingNode.cpp:

(WebCore::ScrollingTreeOverflowScrollingNode::dumpProperties const):

  • page/scrolling/ScrollingTreeOverflowScrollingNode.h:
  • page/scrolling/cocoa/ScrollingTreePositionedNode.mm:

(WebCore::ScrollingTreePositionedNode::commitStateBeforeChildren):
(WebCore::ScrollingTreePositionedNode::applyLayerPositions):
(WebCore::ScrollingTreePositionedNode::relatedNodeScrollPositionDidChange):

  • rendering/RenderLayerCompositor.cpp:

(WebCore::layerContainingBlockCrossesCoordinatedScrollingBoundary):
(WebCore::layerParentedAcrossCoordinatedScrollingBoundary):
(WebCore::RenderLayerCompositor::computeCoordinatedPositioningForLayer const):
(WebCore::collectRelatedCoordinatedScrollingNodes):
(WebCore::RenderLayerCompositor::updateScrollingNodeForPositioningRole):

LayoutTests:

New tests that use uiController.scrollUpdatesDisabled, and are the two move/stationary
cases.

  • platform/ios-wk2/scrollingcoordinator/scrolling-tree/positioned-nodes-expected.txt:
  • scrollingcoordinator/ios/absolute-layer-should-not-move-with-scroll-expected.html: Added.
  • scrollingcoordinator/ios/absolute-layer-should-not-move-with-scroll.html: Added.
  • scrollingcoordinator/ios/relative-layer-should-move-with-scroll-expected.html: Added.
  • scrollingcoordinator/ios/relative-layer-should-move-with-scroll.html: Added.
  • scrollingcoordinator/ios/ui-scrolling-tree-expected.txt: Fixed the last paren showing up.
  • scrollingcoordinator/scrolling-tree/positioned-nodes-expected.txt: We make positioned nodes now.
Location:
trunk
Files:
4 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r242993 r242997  
     12019-03-15  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [Async overflow Scrolling] Update positioned node layers when overflows are scrolled
     4        https://bugs.webkit.org/show_bug.cgi?id=195733
     5        rdar://problem/11642295
     6
     7        Reviewed by Antti Koivisto.
     8
     9        New tests that use uiController.scrollUpdatesDisabled, and are the two move/stationary
     10        cases.
     11
     12        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/positioned-nodes-expected.txt:
     13        * scrollingcoordinator/ios/absolute-layer-should-not-move-with-scroll-expected.html: Added.
     14        * scrollingcoordinator/ios/absolute-layer-should-not-move-with-scroll.html: Added.
     15        * scrollingcoordinator/ios/relative-layer-should-move-with-scroll-expected.html: Added.
     16        * scrollingcoordinator/ios/relative-layer-should-move-with-scroll.html: Added.
     17        * scrollingcoordinator/ios/ui-scrolling-tree-expected.txt: Fixed the last paren showing up.
     18        * scrollingcoordinator/scrolling-tree/positioned-nodes-expected.txt: We make positioned nodes now.
     19
    1202019-03-15  Fujii Hironori  <Hironori.Fujii@sony.com>
    221
  • trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/positioned-nodes-expected.txt

    r242913 r242997  
    1818  (max layout viewport origin (0,141))
    1919  (behavior for fixed 0)
    20   (children 4
     20  (children 5
    2121    (Overflow scrolling node
    2222      (scrollable area size 220 170)
     
    5555      )
    5656    )
     57    (Positioned node
     58      (layout constraints
     59        (layer-position-at-last-layout (10,30))
     60        (positioning-behavior moves))
     61      (related overflow nodes 1)
     62    )
    5763    (Overflow scrolling node
    5864      (scrollable area size 220 170)
  • trunk/LayoutTests/scrollingcoordinator/ios/ui-scrolling-tree-expected.txt

    r217591 r242997  
    1818        (viewport-rect-at-last-layout (0,0) width=320 height=548)
    1919        (layer-position-at-last-layout (12,10)))
    20       (layer top left (12,10))))
     20      (layer top left (12,10)))))
  • trunk/LayoutTests/scrollingcoordinator/scrolling-tree/positioned-nodes-expected.txt

    r242913 r242997  
    1919  (max layout viewport origin (0,141))
    2020  (behavior for fixed 0)
    21   (children 4
     21  (children 5
    2222    (Overflow scrolling node
    2323      (scrollable area size 205 155)
     
    5656      )
    5757    )
     58    (Positioned node
     59      (layout constraints
     60        (layer-position-at-last-layout (10,28))
     61        (positioning-behavior moves))
     62      (related overflow nodes 1)
     63    )
    5864    (Overflow scrolling node
    5965      (scrollable area size 205 155)
  • trunk/Source/WebCore/ChangeLog

    r242995 r242997  
     12019-03-15  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [Async overflow Scrolling] Update positioned node layers when overflows are scrolled
     4        https://bugs.webkit.org/show_bug.cgi?id=195733
     5        rdar://problem/11642295
     6
     7        Reviewed by Antti Koivisto.
     8
     9        Make ScrollingTree positioned nodes in the two cases where we need them, as
     10        detected by RenderLayerCompositor::computeCoordinatedPositioningForLayer().
     11
     12        For "Moves" layers we know that the overflow is not in the z-order ancestor chain,
     13        so ScrollingTree needs a map of overflow node -> affected positioned nodes which
     14        notifyRelatedNodesAfterScrollPositionChange() uses to find nodes to update after
     15        a scroll. Computing these dependent nodes in RenderLayerCompositor() would require
     16        correct dependency analysis between an overflow layers and "positioned" layers which
     17        is hard. It's easier to have "positioned" layers figure out which overflow nodes
     18        affect them, then compute the inverse relationship when the scrolling tree is updated
     19        which happens in ScrollingTreePositionedNode::commitStateBeforeChildren().
     20
     21        Tests: scrollingcoordinator/ios/absolute-layer-should-not-move-with-scroll.html
     22               scrollingcoordinator/ios/relative-layer-should-move-with-scroll.html
     23
     24        * page/scrolling/ScrollingTree.cpp:
     25        (WebCore::ScrollingTree::commitTreeState):
     26        (WebCore::ScrollingTree::applyLayerPositions):
     27        (WebCore::ScrollingTree::notifyRelatedNodesAfterScrollPositionChange):
     28        (WebCore::ScrollingTree::scrollingTreeAsText):
     29        * page/scrolling/ScrollingTree.h:
     30        (WebCore::ScrollingTree::overflowRelatedNodes):
     31        * page/scrolling/ScrollingTreeOverflowScrollingNode.cpp:
     32        (WebCore::ScrollingTreeOverflowScrollingNode::dumpProperties const):
     33        * page/scrolling/ScrollingTreeOverflowScrollingNode.h:
     34        * page/scrolling/cocoa/ScrollingTreePositionedNode.mm:
     35        (WebCore::ScrollingTreePositionedNode::commitStateBeforeChildren):
     36        (WebCore::ScrollingTreePositionedNode::applyLayerPositions):
     37        (WebCore::ScrollingTreePositionedNode::relatedNodeScrollPositionDidChange):
     38        * rendering/RenderLayerCompositor.cpp:
     39        (WebCore::layerContainingBlockCrossesCoordinatedScrollingBoundary):
     40        (WebCore::layerParentedAcrossCoordinatedScrollingBoundary):
     41        (WebCore::RenderLayerCompositor::computeCoordinatedPositioningForLayer const):
     42        (WebCore::collectRelatedCoordinatedScrollingNodes):
     43        (WebCore::RenderLayerCompositor::updateScrollingNodeForPositioningRole):
     44
    1452019-03-15  Antti Koivisto  <antti@apple.com>
    246
  • trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp

    r242913 r242997  
    175175        unvisitedNodes.add(nodeID);
    176176
     177    m_overflowRelatedNodesMap.clear();
     178
    177179    // orphanNodes keeps child nodes alive while we rebuild child lists.
    178180    OrphanScrollingNodeMap orphanNodes;
     
    186188        m_nodeMap.remove(nodeID);
    187189    }
     190
     191    LOG(Scrolling, "committed ScrollingTree\n%s", scrollingTreeAsText(ScrollingStateTreeAsTextBehaviorDebug).utf8().data());
    188192}
    189193
     
    264268        return;
    265269
     270    LOG(Scrolling, "\nScrollingTree %p applyLayerPositions", this);
     271
    266272    applyLayerPositionsRecursive(*m_rootNode, { }, { });
     273
     274    LOG(Scrolling, "ScrollingTree %p applyLayerPositions - done\n", this);
    267275}
    268276
     
    292300void ScrollingTree::notifyRelatedNodesAfterScrollPositionChange(ScrollingTreeScrollingNode& changedNode)
    293301{
     302    Vector<ScrollingNodeID> additionalUpdateRoots;
     303   
    294304    FloatSize deltaFromLastCommittedScrollPosition;
    295305    FloatRect currentFrameLayoutViewport;
     
    301311        if (auto* frameScrollingNode = changedNode.enclosingFrameNodeIncludingSelf())
    302312            currentFrameLayoutViewport = frameScrollingNode->layoutViewport();
     313       
     314        additionalUpdateRoots = overflowRelatedNodes().get(changedNode.scrollingNodeID());
    303315    }
    304316
    305317    notifyRelatedNodesRecursive(changedNode, changedNode, currentFrameLayoutViewport, deltaFromLastCommittedScrollPosition);
     318   
     319    for (auto positionedNodeID : additionalUpdateRoots) {
     320        auto* positionedNode = nodeForID(positionedNodeID);
     321        if (positionedNode)
     322            notifyRelatedNodesRecursive(changedNode, *positionedNode, currentFrameLayoutViewport, deltaFromLastCommittedScrollPosition);
     323    }
    306324}
    307325
     
    452470}
    453471
    454 String ScrollingTree::scrollingTreeAsText()
     472String ScrollingTree::scrollingTreeAsText(ScrollingStateTreeAsTextBehavior behavior)
    455473{
    456474    TextStream ts(TextStream::LineMode::MultipleLine);
    457475
    458     TextStream::GroupScope scope(ts);
    459     ts << "scrolling tree";
    460 
    461     LockHolder locker(m_treeStateMutex);
    462 
    463     if (m_treeState.latchedNodeID)
    464         ts.dumpProperty("latched node", m_treeState.latchedNodeID);
    465 
    466     if (!m_treeState.mainFrameScrollPosition.isZero())
    467         ts.dumpProperty("main frame scroll position", m_treeState.mainFrameScrollPosition);
    468    
    469     if (m_rootNode) {
     476    {
    470477        TextStream::GroupScope scope(ts);
    471         m_rootNode->dump(ts, ScrollingStateTreeAsTextBehaviorIncludeLayerPositions);
    472     }
    473 
     478        ts << "scrolling tree";
     479
     480        LockHolder locker(m_treeStateMutex);
     481
     482        if (m_treeState.latchedNodeID)
     483            ts.dumpProperty("latched node", m_treeState.latchedNodeID);
     484
     485        if (!m_treeState.mainFrameScrollPosition.isZero())
     486            ts.dumpProperty("main frame scroll position", m_treeState.mainFrameScrollPosition);
     487       
     488        if (m_rootNode) {
     489            TextStream::GroupScope scope(ts);
     490            m_rootNode->dump(ts, behavior | ScrollingStateTreeAsTextBehaviorIncludeLayerPositions);
     491        }
     492       
     493        if (behavior & ScrollingStateTreeAsTextBehaviorIncludeNodeIDs && !m_overflowRelatedNodesMap.isEmpty()) {
     494            TextStream::GroupScope scope(ts);
     495            ts << "overflow related nodes";
     496            {
     497                TextStream::IndentScope indentScope(ts);
     498                for (auto& it : m_overflowRelatedNodesMap)
     499                    ts << "\n" << indent << it.key << " -> " << it.value;
     500            }
     501        }
     502    }
    474503    return ts.release();
    475504}
  • trunk/Source/WebCore/page/scrolling/ScrollingTree.h

    r242913 r242997  
    145145        --m_fixedOrStickyNodeCount;
    146146    }
    147    
    148     WEBCORE_EXPORT String scrollingTreeAsText();
     147
     148    // A map of overflow scrolling nodes to positioned nodes which need to be updated
     149    // when the scroller changes, but are not descendants.
     150    using RelatedNodesMap = HashMap<ScrollingNodeID, Vector<ScrollingNodeID>>;
     151    RelatedNodesMap& overflowRelatedNodes() { return m_overflowRelatedNodesMap; }
     152
     153    WEBCORE_EXPORT String scrollingTreeAsText(ScrollingStateTreeAsTextBehavior = ScrollingStateTreeAsTextBehaviorNormal);
    149154   
    150155protected:
     
    167172    using ScrollingTreeNodeMap = HashMap<ScrollingNodeID, ScrollingTreeNode*>;
    168173    ScrollingTreeNodeMap m_nodeMap;
     174
     175    RelatedNodesMap m_overflowRelatedNodesMap;
    169176
    170177    struct TreeState {
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeOverflowScrollingNode.cpp

    r239548 r242997  
    4141ScrollingTreeOverflowScrollingNode::~ScrollingTreeOverflowScrollingNode() = default;
    4242
     43void ScrollingTreeOverflowScrollingNode::dumpProperties(TextStream& ts, ScrollingStateTreeAsTextBehavior behavior) const
     44{
     45    ts << "overflow scrolling node";
     46    ScrollingTreeNode::dumpProperties(ts, behavior);
     47}
     48
    4349} // namespace WebCore
    4450
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeOverflowScrollingNode.h

    r208179 r242997  
    3838protected:
    3939    WEBCORE_EXPORT ScrollingTreeOverflowScrollingNode(ScrollingTree&, ScrollingNodeID);
     40   
     41    WEBCORE_EXPORT void dumpProperties(TextStream&, ScrollingStateTreeAsTextBehavior) const;
    4042};
    4143
  • trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreePositionedNode.h

    r242913 r242997  
    5050    void applyLayerPositions(const FloatRect& layoutViewport, FloatSize& cumulativeDelta) override;
    5151
    52     void dumpProperties(WTF::TextStream&, ScrollingStateTreeAsTextBehavior) const override;
     52    WEBCORE_EXPORT void dumpProperties(WTF::TextStream&, ScrollingStateTreeAsTextBehavior) const override;
    5353
    5454    Vector<ScrollingNodeID> m_relatedOverflowScrollingNodes;
  • trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreePositionedNode.mm

    r242913 r242997  
    3232#import "ScrollingStatePositionedNode.h"
    3333#import "ScrollingTree.h"
     34#import "ScrollingTreeOverflowScrollingNode.h"
    3435#import "ScrollingTreeScrollingNode.h"
    3536#import <QuartzCore/CALayer.h>
     
    6263    if (positionedStateNode.hasChangedProperty(ScrollingStatePositionedNode::LayoutConstraintData))
    6364        m_constraints = positionedStateNode.layoutConstraints();
     65
     66    // Tell the ScrollingTree about non-ancestor overflow nodes which affect this node.
     67    if (m_constraints.scrollPositioningBehavior() == ScrollPositioningBehavior::Moves) {
     68        auto& relatedNodes = scrollingTree().overflowRelatedNodes();
     69        for (auto overflowNodeID : m_relatedOverflowScrollingNodes) {
     70            relatedNodes.ensure(overflowNodeID, [] {
     71                return Vector<ScrollingNodeID>();
     72            }).iterator->value.append(scrollingNodeID());
     73        }
     74    }
    6475}
    6576
    6677void ScrollingTreePositionedNode::applyLayerPositions(const FloatRect&, FloatSize& cumulativeDelta)
    6778{
    68     FloatSize layerOffset; // FIXME: layerOffset needs to be computed by looking at scrolling tree deltas
    69     // in the overflow nodes that affect this node. Some of that may come in via cumulativeDelta.
     79    // Note that we ignore cumulativeDelta because it will contain the delta for ancestor scrollers,
     80    // but not non-ancestor ones, so it's simpler to just recompute from the scrollers we know about here.
     81    FloatSize scrollOffsetSinceLastCommit;
     82    for (auto nodeID : m_relatedOverflowScrollingNodes) {
     83        if (auto* node = scrollingTree().nodeForID(nodeID)) {
     84            if (is<ScrollingTreeOverflowScrollingNode>(node)) {
     85                auto& overflowNode = downcast<ScrollingTreeOverflowScrollingNode>(*node);
     86                scrollOffsetSinceLastCommit += overflowNode.lastCommittedScrollPosition() - overflowNode.currentScrollPosition();
     87            }
     88        }
     89    }
     90    LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreePositionedNode " << scrollingNodeID() << " applyLayerPositions: overflow delta " << scrollOffsetSinceLastCommit);
    7091
    71     LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreePositionedNode " << scrollingNodeID() << " applyLayerPositions: total overflow delta " << layerOffset);
    72 
    73     layerOffset += cumulativeDelta;
    74     // Stationary nodes move in the opposite direction.
    75     if (m_constraints.scrollPositioningBehavior() == ScrollPositioningBehavior::Stationary)
     92    auto layerOffset = -scrollOffsetSinceLastCommit;
     93    if (m_constraints.scrollPositioningBehavior() == ScrollPositioningBehavior::Stationary) {
     94        // Stationary nodes move in the opposite direction.
    7695        layerOffset = -layerOffset;
     96    }
    7797
    7898    FloatPoint layerPosition = m_constraints.layerPositionAtLastLayout() - layerOffset;
    7999    [m_layer _web_setLayerTopLeftPosition:layerPosition - m_constraints.alignmentOffset()];
    80100
    81     cumulativeDelta += layerPosition - m_constraints.layerPositionAtLastLayout();
     101    // FIXME: Should our scroller deltas propagate to descendants?
     102    cumulativeDelta = layerPosition - m_constraints.layerPositionAtLastLayout();
    82103}
    83104
    84105void ScrollingTreePositionedNode::relatedNodeScrollPositionDidChange(const ScrollingTreeScrollingNode& changedNode, const FloatRect& layoutViewport, FloatSize& cumulativeDelta)
    85106{
    86     UNUSED_PARAM(changedNode);
    87     // FIXME: This will avoid doing work if we can determine that changedNode doesn't affect this positioned node.
     107    if (!m_relatedOverflowScrollingNodes.contains(changedNode.scrollingNodeID()))
     108        return;
     109
    88110    applyLayerPositions(layoutViewport, cumulativeDelta);
    89111}
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r242913 r242997  
    28702870}
    28712871
     2872// Is this layer's containingBlock an ancestor of scrollable overflow, and is the layer's compositing ancestor inside that overflow?
     2873static bool layerContainingBlockCrossesCoordinatedScrollingBoundary(const RenderLayer& layer, const RenderLayer& compositedAncestor)
     2874{
     2875    ASSERT(layer.isComposited());
     2876    ASSERT(layer.renderer().style().position() == PositionType::Absolute);
     2877
     2878    bool sawCompositingAncestor = false;
     2879    for (const auto* currLayer = layer.parent(); currLayer; currLayer = currLayer->parent()) {
     2880        if (currLayer->renderer().canContainAbsolutelyPositionedObjects())
     2881            return false;
     2882
     2883        if (currLayer == &compositedAncestor)
     2884            sawCompositingAncestor = true;
     2885
     2886        if (currLayer->hasCompositedScrollableOverflow())
     2887            return sawCompositingAncestor;
     2888    }
     2889
     2890    return false;
     2891}
     2892
     2893// Is there scrollable overflow between this layer and its composited ancestor?
     2894static bool layerParentedAcrossCoordinatedScrollingBoundary(const RenderLayer& layer, const RenderLayer& compositedAncestor)
     2895{
     2896    ASSERT(layer.isComposited());
     2897
     2898    for (const auto* currLayer = layer.parent(); currLayer != &compositedAncestor; currLayer = currLayer->parent()) {
     2899        if (currLayer->hasCompositedScrollableOverflow())
     2900            return true;
     2901    }
     2902
     2903    return false;
     2904}
     2905
    28722906ScrollPositioningBehavior RenderLayerCompositor::computeCoordinatedPositioningForLayer(const RenderLayer& layer) const
    28732907{
     
    28752909        return ScrollPositioningBehavior::None;
    28762910
    2877     // FIXME: This will look at the containing block and stacking context ancestor chains and determine
    2878     // whether this layer needs to be repositioned when a composited overflow scroll scrolls.
     2911    auto* scrollingCoordinator = this->scrollingCoordinator();
     2912    if (!scrollingCoordinator)
     2913        return ScrollPositioningBehavior::None;
     2914
     2915    // There are two cases we have to deal with here:
     2916    // 1. There's a composited overflow:scroll in the parent chain between the renderer and its containing block, and the layer's
     2917    //    composited (z-order) ancestor is inside the scroller or is the scroller. In this case, we have to compensate for scroll position
     2918    //    changes to make the positioned layer stay in the same place. This only applies to position:absolute (since we handle fixed elsewhere).
     2919    auto* compositedAncestor = layer.ancestorCompositingLayer();
     2920
     2921    auto& renderer = layer.renderer();
     2922    if (renderer.isOutOfFlowPositioned() && renderer.style().position() == PositionType::Absolute) {
     2923        if (layerContainingBlockCrossesCoordinatedScrollingBoundary(layer, *compositedAncestor))
     2924            return ScrollPositioningBehavior::Stationary;
     2925
     2926        return ScrollPositioningBehavior::None;
     2927    }
     2928
     2929    // 2. The layer's containing block is the overflow or inside the overflow:scroll, but its z-order ancestor is
     2930    //    outside the overflow:scroll. In that case, we have to move the layer via the scrolling tree to make
     2931    //    it move along with the overflow scrolling.
     2932    if (layerParentedAcrossCoordinatedScrollingBoundary(layer, *compositedAncestor))
     2933        return ScrollPositioningBehavior::Moves;
    28792934
    28802935    return ScrollPositioningBehavior::None;
     2936}
     2937
     2938static Vector<ScrollingNodeID> collectRelatedCoordinatedScrollingNodes(const RenderLayer& layer, ScrollPositioningBehavior positioningBehavior)
     2939{
     2940    Vector<ScrollingNodeID> overflowNodeData;
     2941
     2942    switch (positioningBehavior) {
     2943    case ScrollPositioningBehavior::Moves: {
     2944        // Collect all the composited scrollers between this layer and its composited ancestor.
     2945        auto* compositedAncestor = layer.ancestorCompositingLayer();
     2946        for (const auto* currLayer = layer.parent(); currLayer != compositedAncestor; currLayer = currLayer->parent()) {
     2947            if (currLayer->hasCompositedScrollableOverflow()) {
     2948                auto scrollingNodeID = currLayer->backing()->scrollingNodeIDForRole(ScrollCoordinationRole::Scrolling);
     2949                if (scrollingNodeID)
     2950                    overflowNodeData.append(scrollingNodeID);
     2951                else
     2952                    LOG(Scrolling, "Layer %p doesn't have scrolling node ID yet", &layer);
     2953            }
     2954        }
     2955        break;
     2956    }
     2957    case ScrollPositioningBehavior::Stationary: {
     2958        // Collect all the composited scrollers between this layer and its containing block.
     2959        ASSERT(layer.renderer().style().position() == PositionType::Absolute);
     2960        for (const auto* currLayer = layer.parent(); currLayer; currLayer = currLayer->parent()) {
     2961            if (currLayer->renderer().canContainAbsolutelyPositionedObjects())
     2962                break;
     2963
     2964            if (currLayer->hasCompositedScrollableOverflow()) {
     2965                auto scrollingNodeID = currLayer->backing()->scrollingNodeIDForRole(ScrollCoordinationRole::Scrolling);
     2966                if (scrollingNodeID)
     2967                    overflowNodeData.append(scrollingNodeID);
     2968                else
     2969                    LOG(Scrolling, "Layer %p doesn't have scrolling node ID yet", &layer);
     2970            }
     2971        }
     2972        // Don't need to do anything because the layer is a descendant of the overflow in stacking.
     2973        break;
     2974    }
     2975    case ScrollPositioningBehavior::None:
     2976        ASSERT_NOT_REACHED();
     2977        break;
     2978    }
     2979
     2980    return overflowNodeData;
    28812981}
    28822982
     
    40794179
    40804180    if (changes & ScrollingNodeChangeFlags::LayerGeometry && treeState.parentNodeID) {
    4081         Vector<ScrollingNodeID> relatedNodeIDs; // FIXME: This will do a tree walk to figure out which composited overflows affect this positioned node.
     4181        // Would be nice to avoid calling computeCoordinatedPositioningForLayer() again.
     4182        auto positioningBehavior = computeCoordinatedPositioningForLayer(layer);
     4183        auto relatedNodeIDs = collectRelatedCoordinatedScrollingNodes(layer, positioningBehavior);
    40824184        scrollingCoordinator->setRelatedOverflowScrollingNodes(newNodeID, WTFMove(relatedNodeIDs));
    40834185
     
    40864188        constraints.setAlignmentOffset(graphicsLayer->pixelAlignmentOffset());
    40874189        constraints.setLayerPositionAtLastLayout(graphicsLayer->position());
    4088         // Would be nice to avoid calling computeCoordinatedPositioningForLayer() again.
    4089         constraints.setScrollPositioningBehavior(computeCoordinatedPositioningForLayer(layer));
     4190        constraints.setScrollPositioningBehavior(positioningBehavior);
    40904191        scrollingCoordinator->setPositionedNodeGeometry(newNodeID, constraints);
    40914192    }
Note: See TracChangeset for help on using the changeset viewer.