summaryrefslogtreecommitdiffstats
path: root/WebCore/rendering/RenderSVGContainer.cpp
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2010-09-08 12:18:00 +0100
committerKristian Monsen <kristianm@google.com>2010-09-11 12:08:58 +0100
commit5ddde30071f639962dd557c453f2ad01f8f0fd00 (patch)
tree775803c4ab35af50aa5f5472cd1fb95fe9d5152d /WebCore/rendering/RenderSVGContainer.cpp
parent3e63d9b33b753ca86d0765d1b3d711114ba9e34f (diff)
downloadexternal_webkit-5ddde30071f639962dd557c453f2ad01f8f0fd00.zip
external_webkit-5ddde30071f639962dd557c453f2ad01f8f0fd00.tar.gz
external_webkit-5ddde30071f639962dd557c453f2ad01f8f0fd00.tar.bz2
Merge WebKit at r66666 : Initial merge by git.
Change-Id: I57dedeb49859adc9c539e760f0e749768c66626f
Diffstat (limited to 'WebCore/rendering/RenderSVGContainer.cpp')
-rw-r--r--WebCore/rendering/RenderSVGContainer.cpp38
1 files changed, 23 insertions, 15 deletions
diff --git a/WebCore/rendering/RenderSVGContainer.cpp b/WebCore/rendering/RenderSVGContainer.cpp
index bab07a4..8c99270 100644
--- a/WebCore/rendering/RenderSVGContainer.cpp
+++ b/WebCore/rendering/RenderSVGContainer.cpp
@@ -39,6 +39,7 @@ namespace WebCore {
RenderSVGContainer::RenderSVGContainer(SVGStyledElement* node)
: RenderSVGModelObject(node)
, m_drawsContents(true)
+ , m_needsBoundariesUpdate(true)
{
}
@@ -55,7 +56,7 @@ void RenderSVGContainer::layout()
LayoutRepainter repainter(*this, m_everHadLayout && checkForRepaintDuringLayout());
// Allow RenderSVGTransformableContainer to update its transform.
- calculateLocalTransform();
+ bool updatedTransform = calculateLocalTransform();
SVGRenderSupport::layoutChildren(this, selfNeedsLayout());
@@ -63,6 +64,16 @@ void RenderSVGContainer::layout()
if (m_everHadLayout && selfNeedsLayout())
SVGResourcesCache::clientLayoutChanged(this);
+ // At this point LayoutRepainter already grabbed the old bounds,
+ // recalculate them now so repaintAfterLayout() uses the new bounds.
+ if (m_needsBoundariesUpdate || updatedTransform) {
+ updateCachedBoundaries();
+ m_needsBoundariesUpdate = false;
+
+ // If our bounds changed, notify the parents.
+ RenderSVGModelObject::setNeedsBoundariesUpdate();
+ }
+
repainter.repaintAfterLayout();
setNeedsLayout(false);
}
@@ -86,6 +97,10 @@ void RenderSVGContainer::paint(PaintInfo& paintInfo, int, int)
if (!firstChild() && !selfWillPaint())
return;
+ FloatRect repaintRect = repaintRectInLocalCoordinates();
+ if (!SVGRenderSupport::paintInfoIntersectsRepaintRect(repaintRect, localToParentTransform(), paintInfo))
+ return;
+
PaintInfo childPaintInfo(paintInfo);
childPaintInfo.context->save();
@@ -115,7 +130,7 @@ void RenderSVGContainer::paint(PaintInfo& paintInfo, int, int)
// FIXME: This means our focus ring won't share our rotation like it should.
// We should instead disable our clip during PaintPhaseOutline
if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->outlineWidth() && style()->visibility() == VISIBLE) {
- IntRect paintRectInParent = enclosingIntRect(localToParentTransform().mapRect(repaintRectInLocalCoordinates()));
+ IntRect paintRectInParent = enclosingIntRect(localToParentTransform().mapRect(repaintRect));
paintOutline(paintInfo.context, paintRectInParent.x(), paintRectInParent.y(), paintRectInParent.width(), paintRectInParent.height());
}
}
@@ -128,21 +143,14 @@ void RenderSVGContainer::addFocusRingRects(Vector<IntRect>& rects, int, int)
rects.append(paintRectInParent);
}
-FloatRect RenderSVGContainer::objectBoundingBox() const
+void RenderSVGContainer::updateCachedBoundaries()
{
- return SVGRenderSupport::computeContainerBoundingBox(this, SVGRenderSupport::ObjectBoundingBox);
-}
+ m_objectBoundingBox = FloatRect();
+ m_strokeBoundingBox = FloatRect();
+ m_repaintBoundingBox = FloatRect();
-FloatRect RenderSVGContainer::strokeBoundingBox() const
-{
- return SVGRenderSupport::computeContainerBoundingBox(this, SVGRenderSupport::StrokeBoundingBox);
-}
-
-FloatRect RenderSVGContainer::repaintRectInLocalCoordinates() const
-{
- FloatRect repaintRect = SVGRenderSupport::computeContainerBoundingBox(this, SVGRenderSupport::RepaintBoundingBox);
- SVGRenderSupport::intersectRepaintRectWithResources(this, repaintRect);
- return repaintRect;
+ SVGRenderSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m_strokeBoundingBox, m_repaintBoundingBox);
+ SVGRenderSupport::intersectRepaintRectWithResources(this, m_repaintBoundingBox);
}
bool RenderSVGContainer::nodeAtFloatPoint(const HitTestRequest& request, HitTestResult& result, const FloatPoint& pointInParent, HitTestAction hitTestAction)