Changeset 53343 in webkit


Ignore:
Timestamp:
Jan 15, 2010 12:54:37 PM (14 years ago)
Author:
oliver@apple.com
Message:

2010-01-15 Oliver Hunt <oliver@apple.com>

Reviewed by Dirk Schulze.

Bad DOM performance in large SVG files
https://bugs.webkit.org/show_bug.cgi?id=30055

Add an early return when we go to paint a RenderPath that
isn't in the current clip.

  • rendering/RenderPath.cpp: (WebCore::RenderPath::paint):
  • svg/graphics/SVGImage.cpp: (WebCore::SVGImage::draw):
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r53342 r53343  
     12010-01-15  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Dirk Schulze.
     4
     5        Bad DOM performance in large SVG files
     6        https://bugs.webkit.org/show_bug.cgi?id=30055
     7
     8        Add an early return when we go to paint a RenderPath that
     9        isn't in the current clip.
     10
     11        * rendering/RenderPath.cpp:
     12        (WebCore::RenderPath::paint):
     13        * svg/graphics/SVGImage.cpp:
     14        (WebCore::SVGImage::draw):
     15
    1162010-01-15  Steve Block  <steveblock@google.com>
    217
  • trunk/WebCore/rendering/RenderPath.cpp

    r53334 r53343  
    216216    if (paintInfo.context->paintingDisabled() || style()->visibility() == HIDDEN || m_path.isEmpty())
    217217        return;
    218            
    219     paintInfo.context->save();
    220     paintInfo.context->concatCTM(localToParentTransform());
     218
     219    PaintInfo childPaintInfo(paintInfo);
     220    childPaintInfo.context->save();
     221    applyTransformToPaintInfo(childPaintInfo, m_localTransform);
     222    FloatRect boundingBox = repaintRectInLocalCoordinates();
     223    // FIXME: The empty rect check is to deal with incorrect initial clip in renderSubtreeToImage
     224    // unfortunately fixing that problem is fairly complex unless we were willing to just futz the
     225    // rect to something "close enough"
     226    if (!boundingBox.intersects(childPaintInfo.rect) && !childPaintInfo.rect.isEmpty()) {
     227        childPaintInfo.context->restore();
     228        return;
     229    }
    221230
    222231    SVGResourceFilter* filter = 0;
    223232
    224     FloatRect boundingBox = repaintRectInLocalCoordinates();
    225     if (paintInfo.phase == PaintPhaseForeground) {
    226         PaintInfo savedInfo(paintInfo);
    227 
    228         if (prepareToRenderSVGContent(this, paintInfo, boundingBox, filter)) {
     233    if (childPaintInfo.phase == PaintPhaseForeground) {
     234        PaintInfo savedInfo(childPaintInfo);
     235
     236        if (prepareToRenderSVGContent(this, childPaintInfo, boundingBox, filter)) {
    229237            if (style()->svgStyle()->shapeRendering() == SR_CRISPEDGES)
    230                 paintInfo.context->setShouldAntialias(false);
    231             fillAndStrokePath(m_path, paintInfo.context, style(), this);
     238                childPaintInfo.context->setShouldAntialias(false);
     239            fillAndStrokePath(m_path, childPaintInfo.context, style(), this);
    232240
    233241            if (static_cast<SVGStyledElement*>(node())->supportsMarkers())
    234                 m_markerLayoutInfo.drawMarkers(paintInfo);
     242                m_markerLayoutInfo.drawMarkers(childPaintInfo);
    235243        }
    236         finishRenderSVGContent(this, paintInfo, filter, savedInfo.context);
    237     }
    238 
    239     if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->outlineWidth())
    240         paintOutline(paintInfo.context, static_cast<int>(boundingBox.x()), static_cast<int>(boundingBox.y()),
     244        finishRenderSVGContent(this, childPaintInfo, filter, savedInfo.context);
     245    }
     246
     247    if ((childPaintInfo.phase == PaintPhaseOutline || childPaintInfo.phase == PaintPhaseSelfOutline) && style()->outlineWidth())
     248        paintOutline(childPaintInfo.context, static_cast<int>(boundingBox.x()), static_cast<int>(boundingBox.y()),
    241249            static_cast<int>(boundingBox.width()), static_cast<int>(boundingBox.height()), style());
    242250   
    243     paintInfo.context->restore();
     251    childPaintInfo.context->restore();
    244252}
    245253
  • trunk/WebCore/svg/graphics/SVGImage.cpp

    r52448 r53343  
    194194    if (view->needsLayout())
    195195        view->layout();
    196     view->paint(context, enclosingIntRect(srcRect));
     196    view->paint(context, IntRect(0, 0, view->width(), view->height()));
    197197
    198198    if (compositeOp != CompositeSourceOver)
Note: See TracChangeset for help on using the changeset viewer.