diff options
Diffstat (limited to 'WebCore/rendering/SVGRenderSupport.cpp')
-rw-r--r-- | WebCore/rendering/SVGRenderSupport.cpp | 79 |
1 files changed, 40 insertions, 39 deletions
diff --git a/WebCore/rendering/SVGRenderSupport.cpp b/WebCore/rendering/SVGRenderSupport.cpp index 12d6d77..644ff70 100644 --- a/WebCore/rendering/SVGRenderSupport.cpp +++ b/WebCore/rendering/SVGRenderSupport.cpp @@ -61,7 +61,9 @@ IntRect SVGRenderSupport::clippedOverflowRectForRepaint(RenderObject* object, Re void SVGRenderSupport::computeRectForRepaint(RenderObject* object, RenderBoxModelObject* repaintContainer, IntRect& repaintRect, bool fixed) { - object->style()->svgStyle()->inflateForShadow(repaintRect); + const SVGRenderStyle* svgStyle = object->style()->svgStyle(); + if (const ShadowData* shadow = svgStyle->shadow()) + shadow->adjustRectForShadow(repaintRect); // Translate to coords in our parent renderer, and then call computeRectForRepaint on our parent repaintRect = object->localToParentTransform().mapRect(repaintRect); @@ -86,24 +88,22 @@ bool SVGRenderSupport::prepareToRenderSVGContent(RenderObject* object, PaintInfo const SVGRenderStyle* svgStyle = style->svgStyle(); ASSERT(svgStyle); - FloatRect repaintRect; - // Setup transparency layers before setting up SVG resources! float opacity = style->opacity(); - if (opacity < 1) { - repaintRect = object->repaintRectInLocalCoordinates(); - paintInfo.context->clip(repaintRect); - paintInfo.context->beginTransparencyLayer(opacity); - } + const ShadowData* shadow = svgStyle->shadow(); + if (opacity < 1 || shadow) { + FloatRect repaintRect = object->repaintRectInLocalCoordinates(); - if (const ShadowData* shadow = svgStyle->shadow()) { - // Eventually compute repaint rect, if not done so far. - if (opacity >= 1) - repaintRect = object->repaintRectInLocalCoordinates(); + if (opacity < 1) { + paintInfo.context->clip(repaintRect); + paintInfo.context->beginTransparencyLayer(opacity); + } - paintInfo.context->clip(repaintRect); - paintInfo.context->setShadow(IntSize(shadow->x(), shadow->y()), shadow->blur(), shadow->color(), style->colorSpace()); - paintInfo.context->beginTransparencyLayer(1); + if (shadow) { + paintInfo.context->clip(repaintRect); + paintInfo.context->setShadow(IntSize(shadow->x(), shadow->y()), shadow->blur(), shadow->color(), style->colorSpace()); + paintInfo.context->beginTransparencyLayer(1); + } } SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(object); @@ -154,39 +154,38 @@ void SVGRenderSupport::finishRenderSVGContent(RenderObject* object, PaintInfo& p } #endif - float opacity = style->opacity(); - if (opacity < 1) + if (style->opacity() < 1) paintInfo.context->endTransparencyLayer(); - // This needs to be done separately from opacity, because if both properties are set, - // then the transparency layers are nested. if (svgStyle->shadow()) paintInfo.context->endTransparencyLayer(); } -FloatRect SVGRenderSupport::computeContainerBoundingBox(const RenderObject* container, ContainerBoundingBoxMode mode) +void SVGRenderSupport::computeContainerBoundingBoxes(const RenderObject* container, FloatRect& objectBoundingBox, FloatRect& strokeBoundingBox, FloatRect& repaintBoundingBox) { - FloatRect boundingBox; - for (RenderObject* current = container->firstChild(); current; current = current->nextSibling()) { - FloatRect childBoundingBox; - - switch (mode) { - case ObjectBoundingBox: - childBoundingBox = current->objectBoundingBox(); - break; - case StrokeBoundingBox: - childBoundingBox = current->strokeBoundingBox(); - break; - case RepaintBoundingBox: - childBoundingBox = current->repaintRectInLocalCoordinates(); - break; + if (current->isSVGHiddenContainer()) + continue; + + const AffineTransform& transform = current->localToParentTransform(); + if (transform.isIdentity()) { + objectBoundingBox.unite(current->objectBoundingBox()); + strokeBoundingBox.unite(current->strokeBoundingBox()); + repaintBoundingBox.unite(current->repaintRectInLocalCoordinates()); + } else { + objectBoundingBox.unite(transform.mapRect(current->objectBoundingBox())); + strokeBoundingBox.unite(transform.mapRect(current->strokeBoundingBox())); + repaintBoundingBox.unite(transform.mapRect(current->repaintRectInLocalCoordinates())); } - - boundingBox.unite(current->localToParentTransform().mapRect(childBoundingBox)); } +} + +bool SVGRenderSupport::paintInfoIntersectsRepaintRect(const FloatRect& localRepaintRect, const AffineTransform& localTransform, const PaintInfo& paintInfo) +{ + if (localTransform.isIdentity()) + return localRepaintRect.intersects(paintInfo.rect); - return boundingBox; + return localTransform.mapRect(localRepaintRect).intersects(paintInfo.rect); } const RenderSVGRoot* SVGRenderSupport::findTreeRootObject(const RenderObject* start) @@ -281,7 +280,8 @@ void SVGRenderSupport::intersectRepaintRectWithResources(const RenderObject* obj RenderObject* renderer = const_cast<RenderObject*>(object); SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(renderer); if (!resources) { - svgStyle->inflateForShadow(repaintRect); + if (const ShadowData* shadow = svgStyle->shadow()) + shadow->adjustRectForShadow(repaintRect); return; } @@ -296,7 +296,8 @@ void SVGRenderSupport::intersectRepaintRectWithResources(const RenderObject* obj if (RenderSVGResourceMasker* masker = resources->masker()) repaintRect.intersect(masker->resourceBoundingBox(renderer)); - svgStyle->inflateForShadow(repaintRect); + if (const ShadowData* shadow = svgStyle->shadow()) + shadow->adjustRectForShadow(repaintRect); } bool SVGRenderSupport::pointInClippingArea(RenderObject* object, const FloatPoint& point) |