Title: [249440] trunk/Source/WebCore
Revision
249440
Author
simon.fra...@apple.com
Date
2019-09-03 12:55:11 -0700 (Tue, 03 Sep 2019)

Log Message

Cache "compositingAncestor" during the compositing updateBackingAndHierarchy() tree walk
https://bugs.webkit.org/show_bug.cgi?id=201403

Reviewed by Antti Koivisto.

Finding a layer's compositingAncestor requires an ancestor tree walk. We can avoid this during
compositing updates, since we're already in the middle of a paint-order tree walk, and can just
keep track of the current compositingAncestor on the way down.

Shaves a few % off time in updateCompositingLayers().

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateConfiguration):
(WebCore::ComputedOffsets::ComputedOffsets):
(WebCore::ComputedOffsets::fromAncestorGraphicsLayer):
(WebCore::RenderLayerBacking::computePrimaryGraphicsLayerRect const):
(WebCore::RenderLayerBacking::updateGeometry):
* rendering/RenderLayerBacking.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::UpdateBackingTraversalState::UpdateBackingTraversalState):
(WebCore::RenderLayerCompositor::UpdateBackingTraversalState::stateForDescendants const):
(WebCore::RenderLayerCompositor::updateCompositingLayers):
(WebCore::RenderLayerCompositor::computeCompositingRequirements):
(WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
(WebCore::RenderLayerCompositor::updateLayerCompositingState):
(WebCore::RenderLayerCompositor::computeCoordinatedPositioningForLayer const):
(WebCore::RenderLayerCompositor::coordinatedScrollingRolesForLayer const):
(WebCore::RenderLayerCompositor::updateScrollCoordinationForLayer):
(WebCore::RenderLayerCompositor::updateScrollingNodeForPositioningRole):
* rendering/RenderLayerCompositor.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (249439 => 249440)


--- trunk/Source/WebCore/ChangeLog	2019-09-03 19:53:49 UTC (rev 249439)
+++ trunk/Source/WebCore/ChangeLog	2019-09-03 19:55:11 UTC (rev 249440)
@@ -85,6 +85,39 @@
 
 2019-09-03  Simon Fraser  <simon.fra...@apple.com>
 
+        Cache "compositingAncestor" during the compositing updateBackingAndHierarchy() tree walk
+        https://bugs.webkit.org/show_bug.cgi?id=201403
+
+        Reviewed by Antti Koivisto.
+
+        Finding a layer's compositingAncestor requires an ancestor tree walk. We can avoid this during
+        compositing updates, since we're already in the middle of a paint-order tree walk, and can just
+        keep track of the current compositingAncestor on the way down.
+
+        Shaves a few % off time in updateCompositingLayers().
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateConfiguration):
+        (WebCore::ComputedOffsets::ComputedOffsets):
+        (WebCore::ComputedOffsets::fromAncestorGraphicsLayer):
+        (WebCore::RenderLayerBacking::computePrimaryGraphicsLayerRect const):
+        (WebCore::RenderLayerBacking::updateGeometry):
+        * rendering/RenderLayerBacking.h:
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::UpdateBackingTraversalState::UpdateBackingTraversalState):
+        (WebCore::RenderLayerCompositor::UpdateBackingTraversalState::stateForDescendants const):
+        (WebCore::RenderLayerCompositor::updateCompositingLayers):
+        (WebCore::RenderLayerCompositor::computeCompositingRequirements):
+        (WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
+        (WebCore::RenderLayerCompositor::updateLayerCompositingState):
+        (WebCore::RenderLayerCompositor::computeCoordinatedPositioningForLayer const):
+        (WebCore::RenderLayerCompositor::coordinatedScrollingRolesForLayer const):
+        (WebCore::RenderLayerCompositor::updateScrollCoordinationForLayer):
+        (WebCore::RenderLayerCompositor::updateScrollingNodeForPositioningRole):
+        * rendering/RenderLayerCompositor.h:
+
+2019-09-03  Simon Fraser  <simon.fra...@apple.com>
+
         Make "clips compositing descendants" an indirect compositing reason
         https://bugs.webkit.org/show_bug.cgi?id=201381
 

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (249439 => 249440)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2019-09-03 19:53:49 UTC (rev 249439)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2019-09-03 19:55:11 UTC (rev 249440)
@@ -831,7 +831,7 @@
     updateCustomAppearance(style);
 }
 
-bool RenderLayerBacking::updateConfiguration()
+bool RenderLayerBacking::updateConfiguration(const RenderLayer* compositingAncestor)
 {
     ASSERT(!m_owningLayer.normalFlowListDirty());
     ASSERT(!m_owningLayer.zOrderListsDirty());
@@ -865,7 +865,7 @@
     if (updateDescendantClippingLayer(needsDescendantsClippingLayer))
         layerConfigChanged = true;
 
-    auto* compositingAncestor = m_owningLayer.ancestorCompositingLayer();
+    ASSERT(compositingAncestor == m_owningLayer.ancestorCompositingLayer());
     if (updateAncestorClipping(compositor.clippedByAncestor(m_owningLayer, compositingAncestor), compositingAncestor))
         layerConfigChanged = true;
 
@@ -1026,8 +1026,9 @@
 
 class ComputedOffsets {
 public:
-    ComputedOffsets(const RenderLayer& renderLayer, const LayoutRect& localRect, const LayoutRect& parentGraphicsLayerRect, const LayoutRect& primaryGraphicsLayerRect)
+    ComputedOffsets(const RenderLayer& renderLayer, const RenderLayer* compositingAncestor, const LayoutRect& localRect, const LayoutRect& parentGraphicsLayerRect, const LayoutRect& primaryGraphicsLayerRect)
         : m_renderLayer(renderLayer)
+        , m_compositingAncestor(compositingAncestor)
         , m_location(localRect.location())
         , m_parentGraphicsLayerOffset(toLayoutSize(parentGraphicsLayerRect.location()))
         , m_primaryGraphicsLayerOffset(toLayoutSize(primaryGraphicsLayerRect.location()))
@@ -1053,9 +1054,8 @@
     LayoutSize fromAncestorGraphicsLayer()
     {
         if (!m_fromAncestorGraphicsLayer) {
-            auto* compositedAncestor = m_renderLayer.ancestorCompositingLayer();
-            LayoutPoint localPointInAncestorRenderLayerCoords = m_renderLayer.convertToLayerCoords(compositedAncestor, m_location, RenderLayer::AdjustForColumns);
-            m_fromAncestorGraphicsLayer = computeOffsetFromAncestorGraphicsLayer(compositedAncestor, localPointInAncestorRenderLayerCoords, m_deviceScaleFactor);
+            LayoutPoint localPointInAncestorRenderLayerCoords = m_renderLayer.convertToLayerCoords(m_compositingAncestor, m_location, RenderLayer::AdjustForColumns);
+            m_fromAncestorGraphicsLayer = computeOffsetFromAncestorGraphicsLayer(m_compositingAncestor, localPointInAncestorRenderLayerCoords, m_deviceScaleFactor);
         }
         return m_fromAncestorGraphicsLayer.value();
     }
@@ -1065,6 +1065,7 @@
     Optional<LayoutSize> m_fromPrimaryGraphicsLayer;
     
     const RenderLayer& m_renderLayer;
+    const RenderLayer* m_compositingAncestor;
     // Location is relative to the renderer.
     const LayoutPoint m_location;
     const LayoutSize m_parentGraphicsLayerOffset;
@@ -1072,9 +1073,9 @@
     float m_deviceScaleFactor;
 };
 
-LayoutRect RenderLayerBacking::computePrimaryGraphicsLayerRect(const LayoutRect& parentGraphicsLayerRect) const
+LayoutRect RenderLayerBacking::computePrimaryGraphicsLayerRect(const RenderLayer* compositedAncestor, const LayoutRect& parentGraphicsLayerRect) const
 {
-    ComputedOffsets compositedBoundsOffset(m_owningLayer, compositedBounds(), parentGraphicsLayerRect, { });
+    ComputedOffsets compositedBoundsOffset(m_owningLayer, compositedAncestor, compositedBounds(), parentGraphicsLayerRect, { });
     return LayoutRect(encloseRectToDevicePixels(LayoutRect(toLayoutPoint(compositedBoundsOffset.fromParentGraphicsLayer()), compositedBounds().size()),
         deviceScaleFactor()));
 }
@@ -1112,7 +1113,7 @@
     return parentGraphicsLayerRect;
 }
 
-void RenderLayerBacking::updateGeometry()
+void RenderLayerBacking::updateGeometry(const RenderLayer* compositedAncestor)
 {
     ASSERT(!m_owningLayer.normalFlowListDirty());
     ASSERT(!m_owningLayer.zOrderListsDirty());
@@ -1138,7 +1139,7 @@
     updateBlendMode(style);
 #endif
 
-    auto* compositedAncestor = m_owningLayer.ancestorCompositingLayer();
+    ASSERT(compositedAncestor == m_owningLayer.ancestorCompositingLayer());
     LayoutRect parentGraphicsLayerRect = computeParentGraphicsLayerRect(compositedAncestor);
 
     if (m_ancestorClippingStack) {
@@ -1168,10 +1169,10 @@
         parentGraphicsLayerRect = lastClipLayerRect;
     }
 
-    LayoutRect primaryGraphicsLayerRect = computePrimaryGraphicsLayerRect(parentGraphicsLayerRect);
+    LayoutRect primaryGraphicsLayerRect = computePrimaryGraphicsLayerRect(compositedAncestor, parentGraphicsLayerRect);
 
-    ComputedOffsets compositedBoundsOffset(m_owningLayer, compositedBounds(), parentGraphicsLayerRect, primaryGraphicsLayerRect);
-    ComputedOffsets rendererOffset(m_owningLayer, { }, parentGraphicsLayerRect, primaryGraphicsLayerRect);
+    ComputedOffsets compositedBoundsOffset(m_owningLayer, compositedAncestor, compositedBounds(), parentGraphicsLayerRect, primaryGraphicsLayerRect);
+    ComputedOffsets rendererOffset(m_owningLayer, compositedAncestor, { }, parentGraphicsLayerRect, primaryGraphicsLayerRect);
 
     m_compositedBoundsOffsetFromGraphicsLayer = compositedBoundsOffset.fromPrimaryGraphicsLayer();
 
@@ -1281,7 +1282,7 @@
 
     if (m_owningLayer.reflectionLayer() && m_owningLayer.reflectionLayer()->isComposited()) {
         auto* reflectionBacking = m_owningLayer.reflectionLayer()->backing();
-        reflectionBacking->updateGeometry();
+        reflectionBacking->updateGeometry(&m_owningLayer);
         
         // The reflection layer has the bounds of m_owningLayer.reflectionLayer(),
         // but the reflected layer is the bounds of this layer, so we need to position it appropriately.

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (249439 => 249440)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.h	2019-09-03 19:53:49 UTC (rev 249439)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h	2019-09-03 19:55:11 UTC (rev 249440)
@@ -81,10 +81,10 @@
     void updateConfigurationAfterStyleChange();
 
     // Returns true if layer configuration changed.
-    bool updateConfiguration();
+    bool updateConfiguration(const RenderLayer* compositingAncestor);
 
     // Update graphics layer position and bounds.
-    void updateGeometry();
+    void updateGeometry(const RenderLayer* compositingAncestor);
 
     // Update state the requires that descendant layers have been updated.
     void updateAfterDescendants();
@@ -385,7 +385,7 @@
 
     bool canIssueSetNeedsDisplay() const { return !paintsIntoWindow() && !paintsIntoCompositedAncestor(); }
     LayoutRect computeParentGraphicsLayerRect(const RenderLayer* compositedAncestor) const;
-    LayoutRect computePrimaryGraphicsLayerRect(const LayoutRect& parentGraphicsLayerRect) const;
+    LayoutRect computePrimaryGraphicsLayerRect(const RenderLayer* compositedAncestor, const LayoutRect& parentGraphicsLayerRect) const;
 
     RenderLayer& m_owningLayer;
     

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (249439 => 249440)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2019-09-03 19:53:49 UTC (rev 249439)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2019-09-03 19:55:11 UTC (rev 249440)
@@ -199,6 +199,28 @@
 #endif
 };
 
+struct RenderLayerCompositor::UpdateBackingTraversalState {
+
+    UpdateBackingTraversalState(RenderLayer* compAncestor = nullptr)
+        : compositingAncestor(compAncestor)
+    {
+    }
+
+    UpdateBackingTraversalState stateForDescendants() const
+    {
+        UpdateBackingTraversalState state(compositingAncestor);
+#if !LOG_DISABLED
+        state.depth = depth + 1;
+#endif
+        return state;
+    }
+
+    RenderLayer* compositingAncestor;
+#if !LOG_DISABLED
+    unsigned depth { 0 };
+#endif
+};
+
 class RenderLayerCompositor::BackingSharingState {
     WTF_MAKE_NONCOPYABLE(BackingSharingState);
 public:
@@ -791,8 +813,9 @@
         if (!m_renderView.frame().isMainFrame())
             scrollingTreeState.parentNodeID = frameHostingNodeForFrame(m_renderView.frame());
 
+        UpdateBackingTraversalState traversalState;
         Vector<Ref<GraphicsLayer>> childList;
-        updateBackingAndHierarchy(*updateRoot, childList, scrollingTreeState);
+        updateBackingAndHierarchy(*updateRoot, childList, traversalState, scrollingTreeState);
 
         // Host the document layer in the RenderView's root layer.
         appendDocumentOverlayLayers(childList);
@@ -1052,7 +1075,7 @@
     }
 
     // Update layer state bits.
-    if (layer.reflectionLayer() && updateLayerCompositingState(*layer.reflectionLayer(), queryData, CompositingChangeRepaintNow))
+    if (layer.reflectionLayer() && updateLayerCompositingState(*layer.reflectionLayer(), &layer, queryData, CompositingChangeRepaintNow))
         layer.setNeedsCompositingLayerConnection();
     
     // FIXME: clarify needsCompositingPaintOrderChildrenUpdate. If a composited layer gets a new ancestor, it needs geometry computations.
@@ -1175,7 +1198,7 @@
     ASSERT(!layer.needsCompositingRequirementsTraversal());
 }
 
-void RenderLayerCompositor::updateBackingAndHierarchy(RenderLayer& layer, Vector<Ref<GraphicsLayer>>& childLayersOfEnclosingLayer, ScrollingTreeState& scrollingTreeState, OptionSet<UpdateLevel> updateLevel, int depth)
+void RenderLayerCompositor::updateBackingAndHierarchy(RenderLayer& layer, Vector<Ref<GraphicsLayer>>& childLayersOfEnclosingLayer, UpdateBackingTraversalState& traversalState, ScrollingTreeState& scrollingTreeState, OptionSet<UpdateLevel> updateLevel)
 {
     layer.updateDescendantDependentFlags();
     layer.updateLayerListsIfNeeded();
@@ -1184,7 +1207,8 @@
     if (layer.descendantsNeedUpdateBackingAndHierarchyTraversal())
         updateLevel.add(UpdateLevel::AllDescendants);
 
-    ScrollingTreeState stateForDescendants = scrollingTreeState;
+    ScrollingTreeState scrollingStateForDescendants = scrollingTreeState;
+    UpdateBackingTraversalState traversalStateForDescendants = traversalState.stateForDescendants();
 
     auto* layerBacking = layer.backing();
     if (layerBacking) {
@@ -1199,7 +1223,7 @@
         }
         
         if (layerNeedsUpdate || layer.needsCompositingConfigurationUpdate()) {
-            if (layerBacking->updateConfiguration()) {
+            if (layerBacking->updateConfiguration(traversalState.compositingAncestor)) {
                 layerNeedsUpdate = true; // We also need to update geometry.
                 layer.setNeedsCompositingLayerConnection();
             }
@@ -1209,7 +1233,7 @@
         
         OptionSet<ScrollingNodeChangeFlags> scrollingNodeChanges = { ScrollingNodeChangeFlags::Layer };
         if (layerNeedsUpdate || layer.needsCompositingGeometryUpdate()) {
-            layerBacking->updateGeometry();
+            layerBacking->updateGeometry(traversalState.compositingAncestor);
             scrollingNodeChanges.add(ScrollingNodeChangeFlags::LayerGeometry);
         } else if (layer.needsScrollingTreeUpdate())
             scrollingNodeChanges.add(ScrollingNodeChangeFlags::LayerGeometry);
@@ -1222,7 +1246,7 @@
         if (auto* reflection = layer.reflectionLayer()) {
             if (auto* reflectionBacking = reflection->backing()) {
                 reflectionBacking->updateCompositedBounds();
-                reflectionBacking->updateGeometry();
+                reflectionBacking->updateGeometry(&layer);
                 reflectionBacking->updateAfterDescendants();
             }
         }
@@ -1232,13 +1256,13 @@
 
         // FIXME: do based on dirty flags. Need to do this for changes of geometry, configuration and hierarchy.
         // Need to be careful to do the right thing when a scroll-coordinated layer loses a scroll-coordinated ancestor.
-        stateForDescendants.parentNodeID = updateScrollCoordinationForLayer(layer, scrollingTreeState, scrollingNodeChanges);
-        stateForDescendants.nextChildIndex = 0;
+        scrollingStateForDescendants.parentNodeID = updateScrollCoordinationForLayer(layer, traversalState.compositingAncestor, scrollingTreeState, scrollingNodeChanges);
+        scrollingStateForDescendants.nextChildIndex = 0;
+        
+        traversalStateForDescendants.compositingAncestor = &layer;
 
 #if !LOG_DISABLED
-        logLayerInfo(layer, "updateBackingAndHierarchy", depth);
-#else
-        UNUSED_PARAM(depth);
+        logLayerInfo(layer, "updateBackingAndHierarchy", traversalState.depth);
 #endif
     }
 
@@ -1269,15 +1293,15 @@
 
     if (requireDescendantTraversal) {
         for (auto* renderLayer : layer.negativeZOrderLayers())
-            updateBackingAndHierarchy(*renderLayer, childList, stateForDescendants, updateLevel, depth + 1);
+            updateBackingAndHierarchy(*renderLayer, childList, traversalStateForDescendants, scrollingStateForDescendants, updateLevel);
 
         appendForegroundLayerIfNecessary();
 
         for (auto* renderLayer : layer.normalFlowLayers())
-            updateBackingAndHierarchy(*renderLayer, childList, stateForDescendants, updateLevel, depth + 1);
+            updateBackingAndHierarchy(*renderLayer, childList, traversalStateForDescendants, scrollingStateForDescendants, updateLevel);
         
         for (auto* renderLayer : layer.positiveZOrderLayers())
-            updateBackingAndHierarchy(*renderLayer, childList, stateForDescendants, updateLevel, depth + 1);
+            updateBackingAndHierarchy(*renderLayer, childList, traversalStateForDescendants, scrollingStateForDescendants, updateLevel);
     } else if (requiresChildRebuild)
         appendForegroundLayerIfNecessary();
 
@@ -1689,13 +1713,13 @@
     return layerChanged;
 }
 
-bool RenderLayerCompositor::updateLayerCompositingState(RenderLayer& layer, RequiresCompositingData& queryData, CompositingChangeRepaint shouldRepaint)
+bool RenderLayerCompositor::updateLayerCompositingState(RenderLayer& layer, const RenderLayer* compositingAncestor, RequiresCompositingData& queryData, CompositingChangeRepaint shouldRepaint)
 {
     bool layerChanged = updateBacking(layer, queryData, shouldRepaint);
 
     // See if we need content or clipping layers. Methods called here should assume
     // that the compositing state of descendant layers has not been updated yet.
-    if (layer.backing() && layer.backing()->updateConfiguration())
+    if (layer.backing() && layer.backing()->updateConfiguration(compositingAncestor))
         layerChanged = true;
 
     return layerChanged;
@@ -3241,7 +3265,7 @@
     });
 }
 
-ScrollPositioningBehavior RenderLayerCompositor::computeCoordinatedPositioningForLayer(const RenderLayer& layer) const
+ScrollPositioningBehavior RenderLayerCompositor::computeCoordinatedPositioningForLayer(const RenderLayer& layer, const RenderLayer* compositedAncestor) const
 {
     if (layer.isRenderViewLayer())
         return ScrollPositioningBehavior::None;
@@ -3256,7 +3280,6 @@
     if (!scrollingCoordinator)
         return ScrollPositioningBehavior::None;
 
-    auto* compositedAncestor = layer.ancestorCompositingLayer();
     if (!compositedAncestor) {
         ASSERT_NOT_REACHED();
         return ScrollPositioningBehavior::None;
@@ -4306,7 +4329,7 @@
     backing->detachFromScrollingCoordinator(roles);
 }
 
-OptionSet<ScrollCoordinationRole> RenderLayerCompositor::coordinatedScrollingRolesForLayer(const RenderLayer& layer) const
+OptionSet<ScrollCoordinationRole> RenderLayerCompositor::coordinatedScrollingRolesForLayer(const RenderLayer& layer, const RenderLayer* compositingAncestor) const
 {
     OptionSet<ScrollCoordinationRole> coordinationRoles;
     if (isViewportConstrainedFixedOrStickyLayer(layer))
@@ -4315,7 +4338,7 @@
     if (useCoordinatedScrollingForLayer(layer))
         coordinationRoles.add(ScrollCoordinationRole::Scrolling);
 
-    auto coordinatedPositioning = computeCoordinatedPositioningForLayer(layer);
+    auto coordinatedPositioning = computeCoordinatedPositioningForLayer(layer, compositingAncestor);
     switch (coordinatedPositioning) {
     case ScrollPositioningBehavior::Moves:
         coordinationRoles.add(ScrollCoordinationRole::ScrollingProxy);
@@ -4333,9 +4356,9 @@
     return coordinationRoles;
 }
 
-ScrollingNodeID RenderLayerCompositor::updateScrollCoordinationForLayer(RenderLayer& layer, ScrollingTreeState& treeState, OptionSet<ScrollingNodeChangeFlags> changes)
+ScrollingNodeID RenderLayerCompositor::updateScrollCoordinationForLayer(RenderLayer& layer, const RenderLayer* compositingAncestor, ScrollingTreeState& treeState, OptionSet<ScrollingNodeChangeFlags> changes)
 {
-    auto roles = coordinatedScrollingRolesForLayer(layer);
+    auto roles = coordinatedScrollingRolesForLayer(layer, compositingAncestor);
 
 #if PLATFORM(IOS_FAMILY)
     if (m_legacyScrollingLayerCoordinator) {
@@ -4358,7 +4381,7 @@
 
     // If there's a positioning node, it's the parent scrolling node for fixed/sticky/scrolling/frame hosting.
     if (roles.contains(ScrollCoordinationRole::Positioning)) {
-        newNodeID = updateScrollingNodeForPositioningRole(layer, *currentTreeState, changes);
+        newNodeID = updateScrollingNodeForPositioningRole(layer, compositingAncestor, *currentTreeState, changes);
         childTreeState.parentNodeID = newNodeID;
         currentTreeState = &childTreeState;
     } else
@@ -4584,7 +4607,7 @@
     return newNodeID;
 }
 
-ScrollingNodeID RenderLayerCompositor::updateScrollingNodeForPositioningRole(RenderLayer& layer, ScrollingTreeState& treeState, OptionSet<ScrollingNodeChangeFlags> changes)
+ScrollingNodeID RenderLayerCompositor::updateScrollingNodeForPositioningRole(RenderLayer& layer, const RenderLayer* compositingAncestor, ScrollingTreeState& treeState, OptionSet<ScrollingNodeChangeFlags> changes)
 {
     auto* scrollingCoordinator = this->scrollingCoordinator();
 
@@ -4601,7 +4624,7 @@
 
     if (changes & ScrollingNodeChangeFlags::LayerGeometry && treeState.parentNodeID) {
         // Would be nice to avoid calling computeCoordinatedPositioningForLayer() again.
-        auto positioningBehavior = computeCoordinatedPositioningForLayer(layer);
+        auto positioningBehavior = computeCoordinatedPositioningForLayer(layer, compositingAncestor);
         auto relatedNodeIDs = collectRelatedCoordinatedScrollingNodes(layer, positioningBehavior);
         scrollingCoordinator->setRelatedOverflowScrollingNodes(newNodeID, WTFMove(relatedNodeIDs));
 

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (249439 => 249440)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2019-09-03 19:53:49 UTC (rev 249439)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2019-09-03 19:55:11 UTC (rev 249440)
@@ -208,7 +208,7 @@
         bool reevaluateAfterLayout { false };
     };
 
-    bool updateLayerCompositingState(RenderLayer&, RequiresCompositingData&, CompositingChangeRepaint = CompositingChangeRepaintNow);
+    bool updateLayerCompositingState(RenderLayer&, const RenderLayer* compositingAncestor, RequiresCompositingData&, CompositingChangeRepaint = CompositingChangeRepaintNow);
 
     // Whether layer's backing needs a graphics layer to do clipping by an ancestor (non-stacking-context parent with overflow).
     bool clippedByAncestor(RenderLayer&, const RenderLayer* compositingAncestor) const;
@@ -347,7 +347,7 @@
     // FIXME: make the coordinated/async terminology consistent.
     bool isViewportConstrainedFixedOrStickyLayer(const RenderLayer&) const;
     bool useCoordinatedScrollingForLayer(const RenderLayer&) const;
-    ScrollPositioningBehavior computeCoordinatedPositioningForLayer(const RenderLayer&) const;
+    ScrollPositioningBehavior computeCoordinatedPositioningForLayer(const RenderLayer&, const RenderLayer* compositingAncestor) const;
     bool isLayerForIFrameWithScrollCoordinatedContents(const RenderLayer&) const;
 
     ScrollableArea* scrollableAreaForScrollLayerID(ScrollingNodeID) const;
@@ -390,6 +390,7 @@
     class BackingSharingState;
     struct CompositingState;
     struct OverlapExtent;
+    struct UpdateBackingTraversalState;
 
     // Returns true if the policy changed.
     bool updateCompositingPolicy();
@@ -440,7 +441,7 @@
         CompositedChildren      = 1 << 1,
     };
     // Recurses down the tree, parenting descendant compositing layers and collecting an array of child layers for the current compositing layer.
-    void updateBackingAndHierarchy(RenderLayer&, Vector<Ref<GraphicsLayer>>& childGraphicsLayersOfEnclosingLayer, struct ScrollingTreeState&, OptionSet<UpdateLevel> = { }, int depth = 0);
+    void updateBackingAndHierarchy(RenderLayer&, Vector<Ref<GraphicsLayer>>& childGraphicsLayersOfEnclosingLayer, struct UpdateBackingTraversalState&, struct ScrollingTreeState&, OptionSet<UpdateLevel> = { });
 
     bool layerHas3DContent(const RenderLayer&) const;
     bool isRunningTransformAnimation(RenderLayerModelObject&) const;
@@ -512,10 +513,10 @@
     ScrollingNodeID attachScrollingNode(RenderLayer&, ScrollingNodeType, struct ScrollingTreeState&);
     ScrollingNodeID registerScrollingNodeID(ScrollingCoordinator&, ScrollingNodeID, ScrollingNodeType, struct ScrollingTreeState&);
 
-    OptionSet<ScrollCoordinationRole> coordinatedScrollingRolesForLayer(const RenderLayer&) const;
+    OptionSet<ScrollCoordinationRole> coordinatedScrollingRolesForLayer(const RenderLayer&, const RenderLayer* compositingAncestor) const;
 
     // Returns the ScrollingNodeID which acts as the parent for children.
-    ScrollingNodeID updateScrollCoordinationForLayer(RenderLayer&, struct ScrollingTreeState&, OptionSet<ScrollingNodeChangeFlags>);
+    ScrollingNodeID updateScrollCoordinationForLayer(RenderLayer&, const RenderLayer* compositingAncestor, struct ScrollingTreeState&, OptionSet<ScrollingNodeChangeFlags>);
 
     // These return the ScrollingNodeID which acts as the parent for children.
     ScrollingNodeID updateScrollingNodeForViewportConstrainedRole(RenderLayer&, struct ScrollingTreeState&, OptionSet<ScrollingNodeChangeFlags>);
@@ -522,7 +523,7 @@
     ScrollingNodeID updateScrollingNodeForScrollingRole(RenderLayer&, struct ScrollingTreeState&, OptionSet<ScrollingNodeChangeFlags>);
     ScrollingNodeID updateScrollingNodeForScrollingProxyRole(RenderLayer&, struct ScrollingTreeState&, OptionSet<ScrollingNodeChangeFlags>);
     ScrollingNodeID updateScrollingNodeForFrameHostingRole(RenderLayer&, struct ScrollingTreeState&, OptionSet<ScrollingNodeChangeFlags>);
-    ScrollingNodeID updateScrollingNodeForPositioningRole(RenderLayer&, struct ScrollingTreeState&, OptionSet<ScrollingNodeChangeFlags>);
+    ScrollingNodeID updateScrollingNodeForPositioningRole(RenderLayer&, const RenderLayer* compositingAncestor, struct ScrollingTreeState&, OptionSet<ScrollingNodeChangeFlags>);
 
     void updateScrollingNodeLayers(ScrollingNodeID, RenderLayer&, ScrollingCoordinator&);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to