2010-07-05 Nikolas Zimmermann <nzimmermann@rim.com>
Reviewed by Dirk Schulze.
SVGRenderContainer forces too many kids to relayout
https://bugs.webkit.org/show_bug.cgi?id=15391
Fixing a long-standing performance issue. We should only ever need to relayout container children when the parent bounds change.
The bounds of a container can only change, if the outermost RenderSVGRoot container uses relative length values and its size changes.
This can either happen when the window resizes for standalone SVG documents, or if an enclosing RenderBox changes width/height values.
Only relayout container children if the container has selfNeedsLayout() true, or if the parent bounds change.
Lively Kernel doesn't do any relayouts anymore, except if you change the Safari window size, this is a great progression.
* rendering/RenderPath.cpp:
(WebCore::RenderPath::layout): No need to special case Path updates, if the element uses relative lengths. SVGRenderSupport now handles this case.
* rendering/RenderSVGContainer.cpp:
(WebCore::RenderSVGContainer::layout): Fix some style issues.
* rendering/RenderSVGContainer.h:
(WebCore::RenderSVGContainer::setDrawsContents): Inlined for speed.
(WebCore::RenderSVGContainer::drawsContents): Ditto.
* rendering/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::RenderSVGRoot): Initialize m_isLayoutSizeChanged to false.
(WebCore::RenderSVGRoot::layout): Set m_isLayoutSizeChanged=true when the RenderSVGRoot size changes during layout.
(WebCore::RenderSVGRoot::calcViewport): Remove hasRelativeLengths() special case.
* rendering/RenderSVGRoot.h:
(WebCore::RenderSVGRoot::isLayoutSizeChanged): New function, which returns true during layout() if the outermost <svg> size changes.
* rendering/RenderSVGViewportContainer.cpp:
(WebCore::RenderSVGViewportContainer::calcViewport): Cleanup code, and remove obsolete hasRelativeLengths() special case.
* rendering/SVGRenderSupport.cpp:
(WebCore::svgRootTreeObject): Added helper function, that returns the RenderSVGRoot for a given RenderObject.
(WebCore::SVGRenderSupport::layoutChildren): Remove FIXME, only relayout container children, if the parent bounds change and the child uses relative lengths.
* svg/SVGStyledElement.cpp:
(WebCore::SVGStyledElement::updateRelativeLengthsInformation): Implemented this function. Keeps track of relative lengths elements, so that the
hasRelativeLengths() information is always up2date.
* svg/SVGStyledElement.h:
(WebCore::SVGStyledElement::hasRelativeLengths): Don't call the virtual selfHasRelativeLengths() information, just return wheter m_elementsWithRelativeLengths is not empty.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@62531 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed