diff options
Diffstat (limited to 'WebCore/rendering/RenderSVGRoot.cpp')
-rw-r--r-- | WebCore/rendering/RenderSVGRoot.cpp | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/WebCore/rendering/RenderSVGRoot.cpp b/WebCore/rendering/RenderSVGRoot.cpp index b66a870..3fd439c 100644 --- a/WebCore/rendering/RenderSVGRoot.cpp +++ b/WebCore/rendering/RenderSVGRoot.cpp @@ -48,6 +48,7 @@ namespace WebCore { RenderSVGRoot::RenderSVGRoot(SVGStyledElement* node) : RenderBox(node) , m_isLayoutSizeChanged(false) + , m_needsBoundariesOrTransformUpdate(true) { setReplaced(true); } @@ -124,6 +125,13 @@ void RenderSVGRoot::layout() SVGRenderSupport::layoutChildren(this, needsLayout); m_isLayoutSizeChanged = false; + // At this point LayoutRepainter already grabbed the old bounds, + // recalculate them now so repaintAfterLayout() uses the new bounds. + if (m_needsBoundariesOrTransformUpdate) { + updateCachedBoundaries(); + m_needsBoundariesOrTransformUpdate = false; + } + repainter.repaintAfterLayout(); view()->enableLayoutState(); @@ -196,6 +204,13 @@ void RenderSVGRoot::destroy() RenderBox::destroy(); } +void RenderSVGRoot::styleWillChange(StyleDifference diff, const RenderStyle* newStyle) +{ + if (diff == StyleDifferenceLayout) + setNeedsBoundariesUpdate(); + RenderBox::styleWillChange(diff, newStyle); +} + void RenderSVGRoot::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) { RenderBox::styleDidChange(diff, oldStyle); @@ -267,24 +282,6 @@ const AffineTransform& RenderSVGRoot::localToParentTransform() const return m_localToParentTransform; } -FloatRect RenderSVGRoot::objectBoundingBox() const -{ - return SVGRenderSupport::computeContainerBoundingBox(this, SVGRenderSupport::ObjectBoundingBox); -} - -FloatRect RenderSVGRoot::strokeBoundingBox() const -{ - return SVGRenderSupport::computeContainerBoundingBox(this, SVGRenderSupport::StrokeBoundingBox); -} - -FloatRect RenderSVGRoot::repaintRectInLocalCoordinates() const -{ - FloatRect repaintRect = SVGRenderSupport::computeContainerBoundingBox(this, SVGRenderSupport::RepaintBoundingBox); - style()->svgStyle()->inflateForShadow(repaintRect); - repaintRect.inflate(borderAndPaddingWidth()); - return repaintRect; -} - IntRect RenderSVGRoot::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) { return SVGRenderSupport::clippedOverflowRectForRepaint(this, repaintContainer); @@ -299,7 +296,10 @@ void RenderSVGRoot::computeRectForRepaint(RenderBoxModelObject* repaintContainer // Apply initial viewport clip - not affected by overflow settings repaintRect.intersect(enclosingIntRect(FloatRect(FloatPoint(), m_viewportSize))); - style()->svgStyle()->inflateForShadow(repaintRect); + const SVGRenderStyle* svgStyle = style()->svgStyle(); + if (const ShadowData* shadow = svgStyle->shadow()) + shadow->adjustRectForShadow(repaintRect); + RenderBox::computeRectForRepaint(repaintContainer, repaintRect, fixed); } @@ -313,6 +313,17 @@ void RenderSVGRoot::mapLocalToContainer(RenderBoxModelObject* repaintContainer, RenderBox::mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState); } +void RenderSVGRoot::updateCachedBoundaries() +{ + m_objectBoundingBox = FloatRect(); + m_strokeBoundingBox = FloatRect(); + m_repaintBoundingBox = FloatRect(); + + SVGRenderSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m_strokeBoundingBox, m_repaintBoundingBox); + SVGRenderSupport::intersectRepaintRectWithResources(this, m_repaintBoundingBox); + m_repaintBoundingBox.inflate(borderAndPaddingWidth()); +} + bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int _x, int _y, int _tx, int _ty, HitTestAction hitTestAction) { IntPoint pointInContainer(_x, _y); |