Title: [245580] branches/safari-608.1.24.20-branch/Source/WebCore
Revision
245580
Author
[email protected]
Date
2019-05-21 10:30:30 -0700 (Tue, 21 May 2019)

Log Message

Cherry-pick r245375. rdar://problem/50865946

    Avoid a recursive descendants layer walk sometimes
    https://bugs.webkit.org/show_bug.cgi?id=197939

    Reviewed by Zalan Bujtas.

    If a layer got composited post-descendants because it needs to clip, for example, we'd do a recursive
    descendant tree walk to add layers to the overlap map. However, all the descendants would already
    have contributed to the overlap map if some non-root ancestor was already composited. So we can
    skip the addDescendantsToOverlapMapRecursive() if we know, before descendants, whether there's
    a non-root composited ancestor.

    * rendering/RenderLayerCompositor.cpp:
    (WebCore::RenderLayerCompositor::CompositingState::hasNonRootCompositedAncestor const):
    (WebCore::RenderLayerCompositor::computeCompositingRequirements):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245375 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-608.1.24.20-branch/Source/WebCore/ChangeLog (245579 => 245580)


--- branches/safari-608.1.24.20-branch/Source/WebCore/ChangeLog	2019-05-21 17:30:27 UTC (rev 245579)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/ChangeLog	2019-05-21 17:30:30 UTC (rev 245580)
@@ -1,5 +1,44 @@
 2019-05-21  Kocsen Chung  <[email protected]>
 
+        Cherry-pick r245375. rdar://problem/50865946
+
+    Avoid a recursive descendants layer walk sometimes
+    https://bugs.webkit.org/show_bug.cgi?id=197939
+    
+    Reviewed by Zalan Bujtas.
+    
+    If a layer got composited post-descendants because it needs to clip, for example, we'd do a recursive
+    descendant tree walk to add layers to the overlap map. However, all the descendants would already
+    have contributed to the overlap map if some non-root ancestor was already composited. So we can
+    skip the addDescendantsToOverlapMapRecursive() if we know, before descendants, whether there's
+    a non-root composited ancestor.
+    
+    * rendering/RenderLayerCompositor.cpp:
+    (WebCore::RenderLayerCompositor::CompositingState::hasNonRootCompositedAncestor const):
+    (WebCore::RenderLayerCompositor::computeCompositingRequirements):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245375 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-05-15  Simon Fraser  <[email protected]>
+
+            Avoid a recursive descendants layer walk sometimes
+            https://bugs.webkit.org/show_bug.cgi?id=197939
+
+            Reviewed by Zalan Bujtas.
+
+            If a layer got composited post-descendants because it needs to clip, for example, we'd do a recursive
+            descendant tree walk to add layers to the overlap map. However, all the descendants would already
+            have contributed to the overlap map if some non-root ancestor was already composited. So we can
+            skip the addDescendantsToOverlapMapRecursive() if we know, before descendants, whether there's
+            a non-root composited ancestor.
+
+            * rendering/RenderLayerCompositor.cpp:
+            (WebCore::RenderLayerCompositor::CompositingState::hasNonRootCompositedAncestor const):
+            (WebCore::RenderLayerCompositor::computeCompositingRequirements):
+
+2019-05-21  Kocsen Chung  <[email protected]>
+
         Cherry-pick r245373. rdar://problem/50865946
 
     Clean up code related to compositing overlap map maintenance

Modified: branches/safari-608.1.24.20-branch/Source/WebCore/rendering/RenderLayerCompositor.cpp (245579 => 245580)


--- branches/safari-608.1.24.20-branch/Source/WebCore/rendering/RenderLayerCompositor.cpp	2019-05-21 17:30:27 UTC (rev 245579)
+++ branches/safari-608.1.24.20-branch/Source/WebCore/rendering/RenderLayerCompositor.cpp	2019-05-21 17:30:30 UTC (rev 245580)
@@ -175,6 +175,11 @@
 #endif
     }
 
+    bool hasNonRootCompositedAncestor() const
+    {
+        return compositingAncestor && !compositingAncestor->isRenderViewLayer();
+    }
+
     RenderLayer* compositingAncestor;
     RenderLayer* backingSharingAncestor { nullptr };
     RenderLayer* stackingContextAncestor { nullptr };
@@ -855,6 +860,7 @@
     RequiresCompositingData queryData;
     bool willBeComposited = layer.isComposited();
     bool becameCompositedAfterDescendantTraversal = false;
+
     if (layer.needsPostLayoutCompositingUpdate() || compositingState.fullPaintOrderTraversalRequired || compositingState.descendantsRequireCompositingUpdate) {
         layer.setIndirectCompositingReason(RenderLayer::IndirectCompositingReason::None);
         willBeComposited = needsToBeComposited(layer, queryData);
@@ -951,6 +957,7 @@
 #endif
 
     bool anyDescendantHas3DTransform = false;
+    bool descendantsAddedToOverlap = currentState.hasNonRootCompositedAncestor();
 
     for (auto* childLayer : layer.negativeZOrderLayers()) {
         computeCompositingRequirements(&layer, *childLayer, overlapMap, currentState, backingSharingState, anyDescendantHas3DTransform);
@@ -1048,7 +1055,7 @@
     compositingState.updateWithDescendantStateAndLayer(currentState, layer, layerExtent);
 
     bool layerContributesToOverlap = currentState.compositingAncestor && !currentState.compositingAncestor->isRenderViewLayer();
-    updateOverlapMap(overlapMap, layer, layerExtent, layerContributesToOverlap, becameCompositedAfterDescendantTraversal);
+    updateOverlapMap(overlapMap, layer, layerExtent, layerContributesToOverlap, becameCompositedAfterDescendantTraversal && !descendantsAddedToOverlap);
 
     // Pop backing/overlap sharing state.
     if ((willBeComposited && !layer.isRenderViewLayer()) || currentState.backingSharingAncestor == &layer) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to