Changeset 133786 in webkit


Ignore:
Timestamp:
Nov 7, 2012 11:26:57 AM (11 years ago)
Author:
pdr@google.com
Message:

Skip SVG repaint tracking when parent container transforms
https://bugs.webkit.org/show_bug.cgi?id=101177

Reviewed by Eric Seidel.

Source/WebCore:

This patch skips child repaint rect checks when a parent container is transformed, leading
to a 75% increase on the RoboHornet SVG benchmark:

http://www.robohornet.org/#et=svg (average of 2 runs)
Before patch: 161.6ms
After patch: 38.5ms

SVG transforms are relative to the local container which makes calculating an absolute
repaint rect expensive because it requires multiplying the local repaint rect by each
parent container's local transform. See SVGRenderSupport::computeFloatRectForRepaint
as an example of this calculation.

This patch takes advantage of SVG's container rules: when a parent container's transform
changes, all children must be repainted (there is no absolute positioning in SVG).
SVGRenderSupport::checkForSVGRepaintDuringLayout has been added which checks for whether
the parent transform changed before doing child repaint checks. A similar optimization is
used in HTML (see RenderObject::checkForRepaintDuringLayout) where no repaint checking
is done when the view is fully repainted.

This code is tested in existing tests.

  • rendering/svg/RenderSVGContainer.cpp:

(WebCore::RenderSVGContainer::layout):

  • rendering/svg/RenderSVGForeignObject.cpp:

(WebCore::RenderSVGForeignObject::layout):

  • rendering/svg/RenderSVGImage.cpp:

(WebCore::RenderSVGImage::layout):

  • rendering/svg/RenderSVGShape.cpp:

(WebCore::RenderSVGShape::layout):

  • rendering/svg/RenderSVGText.cpp:

(WebCore::RenderSVGText::layout):

  • rendering/svg/SVGRenderSupport.cpp:

(WebCore::SVGRenderSupport::checkForSVGRepaintDuringLayout):
(WebCore):

  • rendering/svg/SVGRenderSupport.h:

(SVGRenderSupport):

LayoutTests:

The repaint area in svg/repaint/inner-svg-change-viewBox.svg has
been tightened as a result of this patch.

  • platform/chromium/TestExpectations:
  • platform/mac/TestExpectations:
Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r133784 r133786  
     12012-11-07  Philip Rogers  <pdr@google.com>
     2
     3        Skip SVG repaint tracking when parent container transforms
     4        https://bugs.webkit.org/show_bug.cgi?id=101177
     5
     6        Reviewed by Eric Seidel.
     7
     8        The repaint area in svg/repaint/inner-svg-change-viewBox.svg has
     9        been tightened as a result of this patch.
     10
     11        * platform/chromium/TestExpectations:
     12        * platform/mac/TestExpectations:
     13
    1142012-11-07  Balazs Kelemen  <kbalazs@webkit.org>
    215
  • trunk/LayoutTests/platform/chromium/TestExpectations

    r133767 r133786  
    39913991webkit.org/b/11645 fast/table/025.html [ Failure ]
    39923992
     3993# Rebaseline required after https://bugs.webkit.org/show_bug.cgi?id=101177
     3994webkit.org/b/101177 svg/dynamic-updates/SVGUseElement-dom-requiredFeatures.html [ ImageOnlyFailure Pass ]
     3995webkit.org/b/101177 svg/repaint/inner-svg-change-viewBox.svg [ ImageOnlyFailure Pass ]
     3996
    39933997# These are real failues due to 95121.
    39943998# This is spilling caused by LANCZOS3 scaling algorithm that samples outside the source rect.
  • trunk/LayoutTests/platform/mac/TestExpectations

    r133695 r133786  
    11001100webkit.org/b/90951 fast/text/shaping
    11011101
     1102# Rebaseline required after https://bugs.webkit.org/show_bug.cgi?id=101177
     1103webkit.org/b/101177 svg/dynamic-updates/SVGUseElement-dom-requiredFeatures.html [ ImageOnlyFailure Pass ]
     1104webkit.org/b/101177 svg/repaint/inner-svg-change-viewBox.svg [ ImageOnlyFailure Pass ]
     1105
    11021106webkit.org/b/93247 [ Debug ] fast/lists/list-marker-remove-crash.html [ Crash ]
    11031107
  • trunk/Source/WebCore/ChangeLog

    r133785 r133786  
     12012-11-07  Philip Rogers  <pdr@google.com>
     2
     3        Skip SVG repaint tracking when parent container transforms
     4        https://bugs.webkit.org/show_bug.cgi?id=101177
     5
     6        Reviewed by Eric Seidel.
     7
     8        This patch skips child repaint rect checks when a parent container is transformed, leading
     9        to a 75% increase on the RoboHornet SVG benchmark:
     10            http://www.robohornet.org/#et=svg  (average of 2 runs)
     11            Before patch: 161.6ms
     12            After patch: 38.5ms
     13
     14        SVG transforms are relative to the local container which makes calculating an absolute
     15        repaint rect expensive because it requires multiplying the local repaint rect by each
     16        parent container's local transform. See SVGRenderSupport::computeFloatRectForRepaint
     17        as an example of this calculation.
     18
     19        This patch takes advantage of SVG's container rules: when a parent container's transform
     20        changes, all children must be repainted (there is no absolute positioning in SVG).
     21        SVGRenderSupport::checkForSVGRepaintDuringLayout has been added which checks for whether
     22        the parent transform changed before doing child repaint checks. A similar optimization is
     23        used in HTML (see RenderObject::checkForRepaintDuringLayout) where no repaint checking
     24        is done when the view is fully repainted.
     25
     26        This code is tested in existing tests.
     27
     28        * rendering/svg/RenderSVGContainer.cpp:
     29        (WebCore::RenderSVGContainer::layout):
     30        * rendering/svg/RenderSVGForeignObject.cpp:
     31        (WebCore::RenderSVGForeignObject::layout):
     32        * rendering/svg/RenderSVGImage.cpp:
     33        (WebCore::RenderSVGImage::layout):
     34        * rendering/svg/RenderSVGShape.cpp:
     35        (WebCore::RenderSVGShape::layout):
     36        * rendering/svg/RenderSVGText.cpp:
     37        (WebCore::RenderSVGText::layout):
     38        * rendering/svg/SVGRenderSupport.cpp:
     39        (WebCore::SVGRenderSupport::checkForSVGRepaintDuringLayout):
     40        (WebCore):
     41        * rendering/svg/SVGRenderSupport.h:
     42        (SVGRenderSupport):
     43
    1442012-11-07  Chris Fleizach  <cfleizach@apple.com>
    245
  • trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp

    r131938 r133786  
    5858    ASSERT(!view()->layoutStateEnabled());
    5959
    60     LayoutRepainter repainter(*this, checkForRepaintDuringLayout() || selfWillPaint());
     60    LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringLayout(this) || selfWillPaint());
    6161
    6262    // Allow RenderSVGViewportContainer to update its viewport.
  • trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp

    r131938 r133786  
    128128    ASSERT(!view()->layoutStateEnabled()); // RenderSVGRoot disables layoutState for the SVG rendering tree.
    129129
    130     LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
     130    LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringLayout(this));
    131131    SVGForeignObjectElement* foreign = static_cast<SVGForeignObjectElement*>(node());
    132132
  • trunk/Source/WebCore/rendering/svg/RenderSVGImage.cpp

    r132069 r133786  
    8383    ASSERT(needsLayout());
    8484
    85     LayoutRepainter repainter(*this, checkForRepaintDuringLayout() && selfNeedsLayout());
     85    LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringLayout(this) && selfNeedsLayout());
    8686    updateImageViewport();
    8787
  • trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp

    r131938 r133786  
    146146{
    147147    StackStats::LayoutCheckPoint layoutCheckPoint;
    148     LayoutRepainter repainter(*this, checkForRepaintDuringLayout() && selfNeedsLayout());
     148    LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringLayout(this) && selfNeedsLayout());
    149149    SVGStyledTransformableElement* element = static_cast<SVGStyledTransformableElement*>(node());
    150150
  • trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp

    r131938 r133786  
    350350    StackStats::LayoutCheckPoint layoutCheckPoint;
    351351    ASSERT(needsLayout());
    352     LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
     352    LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringLayout(this));
    353353
    354354    bool updateCachedBoundariesInParents = false;
  • trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp

    r131111 r133786  
    107107}
    108108
     109bool SVGRenderSupport::checkForSVGRepaintDuringLayout(RenderObject* object)
     110{
     111    if (!object->checkForRepaintDuringLayout())
     112        return false;
     113    // When a parent container is transformed in SVG, all children will be painted automatically
     114    // so we are able to skip redundant repaint checks.
     115    RenderObject* parent = object->parent();
     116    return !(parent && parent->isSVGContainer() && toRenderSVGContainer(parent)->didTransformToRootUpdate());
     117}
     118
    109119// Update a bounding box taking into account the validity of the other bounding box.
    110120static inline void updateObjectBoundingBox(FloatRect& objectBoundingBox, bool& objectBoundingBoxValid, RenderObject* other, FloatRect otherBoundingBox)
  • trunk/Source/WebCore/rendering/svg/SVGRenderSupport.h

    r133779 r133786  
    6868    static void mapLocalToContainer(const RenderObject*, RenderLayerModelObject* repaintContainer, TransformState&, bool snapOffsetForTransforms = true, bool* wasFixed = 0);
    6969    static const RenderObject* pushMappingToContainer(const RenderObject*, const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&);
     70    static bool checkForSVGRepaintDuringLayout(RenderObject*);
    7071
    7172    // Shared between SVG renderers and resources.
Note: See TracChangeset for help on using the changeset viewer.