Changeset 26075 in webkit


Ignore:
Timestamp:
Oct 5, 2007 5:56:52 PM (17 years ago)
Author:
eseidel
Message:

2007-10-05 Eric Seidel <eric@webkit.org>

Reviewed by Oliver Hunt.

SVG invalidates way too much during layout()
http://bugs.webkit.org/show_bug.cgi?id=14003

  • ksvg2/svg/SVGElement.cpp: (WebCore::SVGElement::ownerSVGElement): simplify if (WebCore::SVGElement::viewportElement): simplify if
  • rendering/RenderSVGContainer.cpp: (WebCore::RenderSVGContainer::layout): only layout children if parent changed
  • rendering/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::layout): only layout children when size changes
  • rendering/RenderSVGText.cpp: (WebCore::RenderSVGText::layout): hack to avoid bad RenderBlock::layout code
  • rendering/RenderSVGViewportContainer.cpp: (WebCore::RenderSVGViewportContainer::layout): don't use RenderSVGContainer::layout()
Location:
branches/feature-branch/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/feature-branch/WebCore/ChangeLog

    r26073 r26075  
     12007-10-05  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        SVG invalidates way too much during layout()
     6        http://bugs.webkit.org/show_bug.cgi?id=14003
     7
     8        * ksvg2/svg/SVGElement.cpp:
     9        (WebCore::SVGElement::ownerSVGElement): simplify if
     10        (WebCore::SVGElement::viewportElement): simplify if
     11        * rendering/RenderSVGContainer.cpp:
     12        (WebCore::RenderSVGContainer::layout): only layout children if parent changed
     13        * rendering/RenderSVGRoot.cpp:
     14        (WebCore::RenderSVGRoot::layout): only layout children when size changes
     15        * rendering/RenderSVGText.cpp:
     16        (WebCore::RenderSVGText::layout): hack to avoid bad RenderBlock::layout code
     17        * rendering/RenderSVGViewportContainer.cpp:
     18        (WebCore::RenderSVGViewportContainer::layout): don't use RenderSVGContainer::layout()
     19
    1202007-10-05  Oliver Hunt  <oliver@apple.com>
    221
  • branches/feature-branch/WebCore/ksvg2/svg/SVGElement.cpp

    r25754 r26075  
    8989    Node* n = parentNode();
    9090    while (n) {
    91         if (n->nodeType() == ELEMENT_NODE && n->hasTagName(SVGNames::svgTag))
     91        if (n->hasTagName(SVGNames::svgTag))
    9292            return static_cast<SVGSVGElement*>(n);
    9393
     
    104104    Node* n = isShadowNode() ? const_cast<SVGElement*>(this)->shadowParentNode() : parentNode();
    105105    while (n) {
    106         if (n->isElementNode() &&
    107             (n->hasTagName(SVGNames::svgTag) || n->hasTagName(SVGNames::imageTag) || n->hasTagName(SVGNames::symbolTag)))
     106        if (n->hasTagName(SVGNames::svgTag) || n->hasTagName(SVGNames::imageTag) || n->hasTagName(SVGNames::symbolTag))
    108107            return static_cast<SVGElement*>(n);
    109108
  • branches/feature-branch/WebCore/rendering/RenderSVGContainer.cpp

    r25880 r26075  
    235235    IntRect oldOutlineBox;
    236236    bool checkForRepaint = checkForRepaintDuringLayout();
    237     if (selfNeedsLayout() && checkForRepaint) {
     237    if (checkForRepaint) {
    238238        oldBounds = m_absoluteBounds;
    239239        oldOutlineBox = absoluteOutlineBox();
     
    242242    RenderObject* child = firstChild();
    243243    while (child) {
    244         // FIXME: This check is bogus, see http://bugs.webkit.org/show_bug.cgi?id=14003
    245         if (!child->isRenderPath() || static_cast<RenderPath*>(child)->hasRelativeValues())
     244        // Only force our kids to layout if we're being asked to relayout as a result of a parent changing
     245        if (selfNeedsLayout() && (!child->isRenderPath() || static_cast<RenderPath*>(child)->hasRelativeValues()))
    246246            child->setNeedsLayout(true);
    247247
     
    256256    m_absoluteBounds = absoluteClippedOverflowRect();
    257257
    258     if (selfNeedsLayout() && checkForRepaint)
     258    if (checkForRepaint)
    259259        repaintAfterLayoutIfNeeded(oldBounds, oldOutlineBox);
    260260
  • branches/feature-branch/WebCore/rendering/RenderSVGRoot.cpp

    r25957 r26075  
    7171    view()->disableLayoutState();
    7272
    73     IntRect oldBounds;
     73    IntRect oldBounds = m_absoluteBounds;
    7474    IntRect oldOutlineBox;
    7575    bool checkForRepaint = checkForRepaintDuringLayout();
    76     if (selfNeedsLayout() && checkForRepaint) {
    77         oldBounds = m_absoluteBounds;
     76    if (selfNeedsLayout() && checkForRepaint)
    7877        oldOutlineBox = absoluteOutlineBox();
    79     }
    80 
    81     RenderObject* child = firstChild();
    82     while (child) {
    83         // FIXME: This check is bogus, see http://bugs.webkit.org/show_bug.cgi?id=14003
    84         if (!child->isRenderPath() || static_cast<RenderPath*>(child)->hasRelativeValues())
    85             child->setNeedsLayout(true);
    86 
    87         child->layoutIfNeeded();
    88         ASSERT(!child->needsLayout());
    89         child = child->nextSibling();
    90     }
    9178
    9279    calcWidth();
     
    9784    m_width = m_width * svg->currentScale();
    9885    m_height = m_height * svg->currentScale();
     86   
     87    bool boundsChanged = m_absoluteBounds != oldBounds;
     88   
     89    if (boundsChanged || normalChildNeedsLayout() || posChildNeedsLayout()) {
     90        for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
     91            if (boundsChanged && (!child->isRenderPath() || static_cast<RenderPath*>(child)->hasRelativeValues()))
     92                child->setNeedsLayout(true);
     93           
     94            child->layoutIfNeeded();
     95            ASSERT(!child->needsLayout());
     96        }
     97    }
    9998
    10099    if (selfNeedsLayout() && checkForRepaint)
  • branches/feature-branch/WebCore/rendering/RenderSVGText.cpp

    r25888 r26075  
    7171{
    7272    ASSERT(needsLayout());
     73   
     74    // FIXME: This is a hack to avoid the RenderBlock::layout() partial repainting code which is not (yet) SVG aware
     75    setNeedsLayout(true);
    7376
    7477    IntRect oldBounds;
  • branches/feature-branch/WebCore/rendering/RenderSVGViewportContainer.cpp

    r25880 r26075  
    2828
    2929#include "GraphicsContext.h"
     30
     31#include "RenderView.h"
    3032#include "SVGMarkerElement.h"
    3133#include "SVGSVGElement.h"
     
    4547void RenderSVGViewportContainer::layout()
    4648{
     49    ASSERT(needsLayout());
     50   
    4751    calcViewport();
    48     RenderSVGContainer::layout();
     52   
     53    // Arbitrary affine transforms are incompatible with LayoutState.
     54    view()->disableLayoutState();
     55   
     56    IntRect oldBounds = m_absoluteBounds;
     57    IntRect oldOutlineBox;
     58    bool checkForRepaint = checkForRepaintDuringLayout();
     59    if (selfNeedsLayout() && checkForRepaint)
     60        oldOutlineBox = absoluteOutlineBox();
     61   
     62    calcWidth();
     63   
     64    m_absoluteBounds = absoluteClippedOverflowRect();
     65    bool boundsChanged = m_absoluteBounds != oldBounds;
     66   
     67    if (boundsChanged || normalChildNeedsLayout() || posChildNeedsLayout()) {
     68        for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
     69            if (boundsChanged && (!child->isRenderPath() || static_cast<RenderPath*>(child)->hasRelativeValues()))
     70                child->setNeedsLayout(true);
     71           
     72            child->layoutIfNeeded();
     73            ASSERT(!child->needsLayout());
     74        }
     75    }
     76   
     77    if (selfNeedsLayout() && checkForRepaint)
     78        repaintAfterLayoutIfNeeded(oldBounds, oldOutlineBox);
     79   
     80    view()->enableLayoutState();
     81    setNeedsLayout(false);
    4982}
    5083
Note: See TracChangeset for help on using the changeset viewer.