summaryrefslogtreecommitdiffstats
path: root/WebCore/rendering/RenderSVGRoot.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-02-02 14:57:50 +0000
committerSteve Block <steveblock@google.com>2010-02-04 15:06:55 +0000
commitd0825bca7fe65beaee391d30da42e937db621564 (patch)
tree7461c49eb5844ffd1f35d1ba2c8b7584c1620823 /WebCore/rendering/RenderSVGRoot.cpp
parent3db770bd97c5a59b6c7574ca80a39e5a51c1defd (diff)
downloadexternal_webkit-d0825bca7fe65beaee391d30da42e937db621564.zip
external_webkit-d0825bca7fe65beaee391d30da42e937db621564.tar.gz
external_webkit-d0825bca7fe65beaee391d30da42e937db621564.tar.bz2
Merge webkit.org at r54127 : Initial merge by git
Change-Id: Ib661abb595522f50ea406f72d3a0ce17f7193c82
Diffstat (limited to 'WebCore/rendering/RenderSVGRoot.cpp')
-rw-r--r--WebCore/rendering/RenderSVGRoot.cpp39
1 files changed, 21 insertions, 18 deletions
diff --git a/WebCore/rendering/RenderSVGRoot.cpp b/WebCore/rendering/RenderSVGRoot.cpp
index 0a39bf4..4a3bbcc 100644
--- a/WebCore/rendering/RenderSVGRoot.cpp
+++ b/WebCore/rendering/RenderSVGRoot.cpp
@@ -86,23 +86,20 @@ void RenderSVGRoot::layout()
LayoutRepainter repainter(*this, checkForRepaintDuringLayout() && selfNeedsLayout());
+ int oldWidth = width();
calcWidth();
+
+ int oldHeight = height();
calcHeight();
SVGSVGElement* svg = static_cast<SVGSVGElement*>(node());
setWidth(static_cast<int>(width() * svg->currentScale()));
setHeight(static_cast<int>(height() * svg->currentScale()));
-
calcViewport();
-
- for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
- if (selfNeedsLayout()) // either bounds or transform changed, force kids to relayout
- child->setNeedsLayout(true, false);
-
- child->layoutIfNeeded();
- ASSERT(!child->needsLayout());
- }
+ // RenderSVGRoot needs to take special care to propagate window size changes to the children,
+ // if the outermost <svg> is using relative x/y/width/height values. Hence the additonal parameters.
+ layoutChildren(this, selfNeedsLayout() || (svg->hasRelativeValues() && (width() != oldWidth || height() != oldHeight)));
repainter.repaintAfterLayout();
view()->enableLayoutState();
@@ -113,7 +110,7 @@ bool RenderSVGRoot::selfWillPaint() const
{
#if ENABLE(FILTERS)
const SVGRenderStyle* svgStyle = style()->svgStyle();
- SVGResourceFilter* filter = getFilterById(document(), svgStyle->filter());
+ SVGResourceFilter* filter = getFilterById(document(), svgStyle->filter(), this);
if (filter)
return true;
#endif
@@ -153,10 +150,13 @@ void RenderSVGRoot::paint(PaintInfo& paintInfo, int parentX, int parentY)
SVGResourceFilter* filter = 0;
FloatRect boundingBox = repaintRectInLocalCoordinates();
+
+ bool continueRendering = true;
if (childPaintInfo.phase == PaintPhaseForeground)
- prepareToRenderSVGContent(this, childPaintInfo, boundingBox, filter);
+ continueRendering = prepareToRenderSVGContent(this, childPaintInfo, boundingBox, filter);
- RenderBox::paint(childPaintInfo, 0, 0);
+ if (continueRendering)
+ RenderBox::paint(childPaintInfo, 0, 0);
if (childPaintInfo.phase == PaintPhaseForeground)
finishRenderSVGContent(this, childPaintInfo, filter, paintInfo.context);
@@ -224,14 +224,15 @@ TransformationMatrix RenderSVGRoot::localToRepaintContainerTransform(const IntPo
return localToParentTransform() * parentToContainer;
}
-TransformationMatrix RenderSVGRoot::localToParentTransform() const
+const TransformationMatrix& RenderSVGRoot::localToParentTransform() const
{
IntSize parentToBorderBoxOffset = parentOriginToBorderBox();
TransformationMatrix borderBoxOriginToParentOrigin;
borderBoxOriginToParentOrigin.translate(parentToBorderBoxOffset.width(), parentToBorderBoxOffset.height());
- return localToBorderBoxTransform() * borderBoxOriginToParentOrigin;
+ m_localToParentTransform = localToBorderBoxTransform() * borderBoxOriginToParentOrigin;
+ return m_localToParentTransform;
}
// FIXME: This method should be removed as soon as callers to RenderBox::absoluteTransform() can be removed.
@@ -249,7 +250,9 @@ FloatRect RenderSVGRoot::objectBoundingBox() const
FloatRect RenderSVGRoot::repaintRectInLocalCoordinates() const
{
// FIXME: This does not include the border but it should!
- return computeContainerBoundingBox(this, true);
+ FloatRect repaintRect = computeContainerBoundingBox(this, true);
+ style()->svgStyle()->inflateForShadow(repaintRect);
+ return repaintRect;
}
TransformationMatrix RenderSVGRoot::localTransform() const
@@ -259,8 +262,10 @@ TransformationMatrix RenderSVGRoot::localTransform() const
void RenderSVGRoot::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed)
{
- // Apply our local transforms (except for x/y translation) and call RenderBox's method to handle all the normal CSS Box model bits
+ // Apply our local transforms (except for x/y translation), then our shadow,
+ // and then call RenderBox's method to handle all the normal CSS Box model bits
repaintRect = localToBorderBoxTransform().mapRect(repaintRect);
+ style()->svgStyle()->inflateForShadow(repaintRect);
RenderBox::computeRectForRepaint(repaintContainer, repaintRect, fixed);
}
@@ -310,5 +315,3 @@ bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& re
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet