Changeset 249091 in webkit


Ignore:
Timestamp:
Aug 24, 2019 7:14:30 PM (5 years ago)
Author:
Simon Fraser
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:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r249090 r249091  
     12019-08-24  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Have RenderLayer::calculateClipRects() use offsetFromAncestor() when possible
     4        https://bugs.webkit.org/show_bug.cgi?id=201066
     5
     6        Reviewed by Dean Jackson.
     7
     8        offsetFromAncestor() is a layer tree walk, so faster than localToContainerPoint(),
     9        but we can't use it when there are transforms on the layer and intermediates up
     10        to the ancestor.
     11       
     12        canUseConvertToLayerCoords() was trying to answer the question about whether it's
     13        OK to use offsetFromAncestor() (which calls convertToLayerCoords() internally), but
     14        it has insufficient information to make a determination. Leave this issue alone, but
     15        at least rename canUseConvertToLayerCoords().
     16
     17        * rendering/RenderLayer.cpp:
     18        (WebCore::RenderLayer::updateLayerPositions):
     19        (WebCore::RenderLayer::calculateClipRects const):
     20        * rendering/RenderLayer.h:
     21
    1222019-08-24  Simon Fraser  <simon.fraser@apple.com>
    223
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r249088 r249091  
    940940        else {
    941941            // FIXME: It looks suspicious to call convertToLayerCoords here
    942             // as canUseConvertToLayerCoords may be true for an ancestor layer.
     942            // as canUseOffsetFromAncestor may be true for an ancestor layer.
    943943            offsetFromRoot = offsetFromAncestor(root());
    944944        }
     
    56585658#endif
    56595659        // This layer establishes a clip of some kind.
    5660 
    5661         // This offset cannot use convertToLayerCoords, because sometimes our rootLayer may be across
    5662         // some transformed layer boundary, for example, in the RenderLayerCompositor overlapMap, where
    5663         // clipRects are needed in view space.
    5664         LayoutPoint offset(renderer().localToContainerPoint(FloatPoint(), &clipRectsContext.rootLayer->renderer()));
     5660        LayoutPoint offset;
     5661        if (!m_hasTransformedAncestor && canUseOffsetFromAncestor())
     5662            offset = toLayoutPoint(offsetFromAncestor(clipRectsContext.rootLayer, AdjustForColumns));
     5663        else
     5664            offset = LayoutPoint(renderer().localToContainerPoint(FloatPoint(), &clipRectsContext.rootLayer->renderer()));
     5665
    56655666        if (clipRects.fixed() && &clipRectsContext.rootLayer->renderer() == &renderer().view())
    56665667            offset -= toLayoutSize(renderer().view().frameView().scrollPositionForFixedPosition());
     
    62896290            continue;
    62906291
    6291         if (!childLayer->canUseConvertToLayerCoords())
     6292        if (!childLayer->canUseOffsetFromAncestor())
    62926293            continue;
    62936294
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r249088 r249091  
    635635    bool hasAncestorWithFilterOutsets() const;
    636636
    637     bool canUseConvertToLayerCoords() const
    638     {
    639         // These RenderObject have an impact on their layers' without them knowing about it.
     637    bool canUseOffsetFromAncestor() const
     638    {
     639        // FIXME: This really needs to know if there are transforms on this layer and any of the layers
     640        // between it and the ancestor in question.
    640641        return !renderer().hasTransform() && !renderer().isSVGRoot();
    641642    }
Note: See TracChangeset for help on using the changeset viewer.