Title: [249091] trunk/Source/WebCore
Revision
249091
Author
simon.fra...@apple.com
Date
2019-08-24 19:14:30 -0700 (Sat, 24 Aug 2019)

Log Message

Have RenderLayer::calculateClipRects() use offsetFromAncestor() when possible
https://bugs.webkit.org/show_bug.cgi?id=201066

Reviewed by Dean Jackson.

offsetFromAncestor() is a layer tree walk, so faster than localToContainerPoint(),
but we can't use it when there are transforms on the layer and intermediates up
to the ancestor.

canUseConvertToLayerCoords() was trying to answer the question about whether it's
OK to use offsetFromAncestor() (which calls convertToLayerCoords() internally), but
it has insufficient information to make a determination. Leave this issue alone, but
at least rename canUseConvertToLayerCoords().

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateLayerPositions):
(WebCore::RenderLayer::calculateClipRects const):
* rendering/RenderLayer.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (249090 => 249091)


--- trunk/Source/WebCore/ChangeLog	2019-08-24 21:42:42 UTC (rev 249090)
+++ trunk/Source/WebCore/ChangeLog	2019-08-25 02:14:30 UTC (rev 249091)
@@ -1,5 +1,26 @@
 2019-08-24  Simon Fraser  <simon.fra...@apple.com>
 
+        Have RenderLayer::calculateClipRects() use offsetFromAncestor() when possible
+        https://bugs.webkit.org/show_bug.cgi?id=201066
+
+        Reviewed by Dean Jackson.
+
+        offsetFromAncestor() is a layer tree walk, so faster than localToContainerPoint(),
+        but we can't use it when there are transforms on the layer and intermediates up
+        to the ancestor.
+        
+        canUseConvertToLayerCoords() was trying to answer the question about whether it's
+        OK to use offsetFromAncestor() (which calls convertToLayerCoords() internally), but
+        it has insufficient information to make a determination. Leave this issue alone, but
+        at least rename canUseConvertToLayerCoords().
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::updateLayerPositions):
+        (WebCore::RenderLayer::calculateClipRects const):
+        * rendering/RenderLayer.h:
+
+2019-08-24  Simon Fraser  <simon.fra...@apple.com>
+
         Page crashes under CGPathAddUnevenCornersRoundedRect
         https://bugs.webkit.org/show_bug.cgi?id=201117
 

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (249090 => 249091)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2019-08-24 21:42:42 UTC (rev 249090)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2019-08-25 02:14:30 UTC (rev 249091)
@@ -939,7 +939,7 @@
             offsetFromRoot = LayoutSize(toFloatSize(geometryMap->absolutePoint(FloatPoint())));
         else {
             // FIXME: It looks suspicious to call convertToLayerCoords here
-            // as canUseConvertToLayerCoords may be true for an ancestor layer.
+            // as canUseOffsetFromAncestor may be true for an ancestor layer.
             offsetFromRoot = offsetFromAncestor(root());
         }
         positionOverflowControls(roundedIntSize(offsetFromRoot));
@@ -5657,11 +5657,12 @@
     if ((renderer().hasOverflowClip() && (clipRectsContext.respectOverflowClip == RespectOverflowClip || this != clipRectsContext.rootLayer)) || renderer().hasClip()) {
 #endif
         // This layer establishes a clip of some kind.
+        LayoutPoint offset;
+        if (!m_hasTransformedAncestor && canUseOffsetFromAncestor())
+            offset = toLayoutPoint(offsetFromAncestor(clipRectsContext.rootLayer, AdjustForColumns));
+        else
+            offset = LayoutPoint(renderer().localToContainerPoint(FloatPoint(), &clipRectsContext.rootLayer->renderer()));
 
-        // This offset cannot use convertToLayerCoords, because sometimes our rootLayer may be across
-        // some transformed layer boundary, for example, in the RenderLayerCompositor overlapMap, where
-        // clipRects are needed in view space.
-        LayoutPoint offset(renderer().localToContainerPoint(FloatPoint(), &clipRectsContext.rootLayer->renderer()));
         if (clipRects.fixed() && &clipRectsContext.rootLayer->renderer() == &renderer().view())
             offset -= toLayoutSize(renderer().view().frameView().scrollPositionForFixedPosition());
         
@@ -6288,7 +6289,7 @@
         if (childLayer->isComposited())
             continue;
 
-        if (!childLayer->canUseConvertToLayerCoords())
+        if (!childLayer->canUseOffsetFromAncestor())
             continue;
 
         LayoutRect childLocalRect(localRect);

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (249090 => 249091)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2019-08-24 21:42:42 UTC (rev 249090)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2019-08-25 02:14:30 UTC (rev 249091)
@@ -634,9 +634,10 @@
     void setFilterBackendNeedsRepaintingInRect(const LayoutRect&);
     bool hasAncestorWithFilterOutsets() const;
 
-    bool canUseConvertToLayerCoords() const
+    bool canUseOffsetFromAncestor() const
     {
-        // These RenderObject have an impact on their layers' without them knowing about it.
+        // FIXME: This really needs to know if there are transforms on this layer and any of the layers
+        // between it and the ancestor in question.
         return !renderer().hasTransform() && !renderer().isSVGRoot();
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to