Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(894)

Unified Diff: Source/core/layout/svg/SVGLayoutSupport.cpp

Issue 1157843008: Fix paint invalidation for SVG with outline-offset (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/layout/svg/SVGLayoutSupport.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/svg/SVGLayoutSupport.cpp
diff --git a/Source/core/layout/svg/SVGLayoutSupport.cpp b/Source/core/layout/svg/SVGLayoutSupport.cpp
index 44761623f147525d4b275d1032428ef6781842a5..ebe2d4b4b9c09d03420c04b86c1ea7e746e98f9f 100644
--- a/Source/core/layout/svg/SVGLayoutSupport.cpp
+++ b/Source/core/layout/svg/SVGLayoutSupport.cpp
@@ -51,23 +51,32 @@ static inline LayoutRect enclosingIntRectIfNotEmpty(const FloatRect& rect)
return LayoutRect(enclosingIntRect(rect));
}
-LayoutRect SVGLayoutSupport::clippedOverflowRectForPaintInvalidation(const LayoutObject* object, const LayoutBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationState)
+static void inflateWithOutlineIfNeeded(FloatRect& paintInvalidationRect, const ComputedStyle& style)
+{
+ if (!style.hasOutline())
+ return;
+ int outlineSize = 0;
+ if (style.outlineStyleIsAuto())
+ outlineSize = GraphicsContext::focusRingOutsetExtent(style.outlineOffset(), style.outlineWidth());
+ else
+ outlineSize = style.outlineSize();
+ paintInvalidationRect.inflate(outlineSize);
+}
+
+LayoutRect SVGLayoutSupport::clippedOverflowRectForPaintInvalidation(const LayoutObject& object, const LayoutBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationState)
{
// Return early for any cases where we don't actually paint
- if (object->style()->visibility() != VISIBLE && !object->enclosingLayer()->hasVisibleContent())
+ if (object.style()->visibility() != VISIBLE && !object.enclosingLayer()->hasVisibleContent())
return LayoutRect();
- // Pass our local paint rect to computeRectForPaintInvalidation() which will
- // map to parent coords and recurse up the parent chain.
- FloatRect paintInvalidationRect = object->paintInvalidationRectInLocalCoordinates();
- paintInvalidationRect.inflate(object->style()->outlineWidth());
+ FloatRect paintInvalidationRect = object.paintInvalidationRectInLocalCoordinates();
+ inflateWithOutlineIfNeeded(paintInvalidationRect, object.styleRef());
if (paintInvalidationState && paintInvalidationState->canMapToContainer(paintInvalidationContainer)) {
// Compute accumulated SVG transform and apply to local paint rect.
- AffineTransform transform = paintInvalidationState->svgTransform() * object->localToParentTransform();
- paintInvalidationRect = transform.mapRect(paintInvalidationRect);
+ AffineTransform transform = paintInvalidationState->svgTransform() * object.localToParentTransform();
// FIXME: These are quirks carried forward from the old paint invalidation infrastructure.
- LayoutRect rect = enclosingIntRectIfNotEmpty(paintInvalidationRect);
+ LayoutRect rect = enclosingIntRectIfNotEmpty(transform.mapRect(paintInvalidationRect));
// Offset by SVG root paint offset and apply clipping as needed.
rect.move(paintInvalidationState->paintOffset());
if (paintInvalidationState->isClipped())
@@ -81,16 +90,16 @@ LayoutRect SVGLayoutSupport::clippedOverflowRectForPaintInvalidation(const Layou
return rect;
}
-const LayoutSVGRoot& SVGLayoutSupport::mapRectToSVGRootForPaintInvalidation(const LayoutObject* object, const FloatRect& localPaintInvalidationRect, LayoutRect& rect)
+const LayoutSVGRoot& SVGLayoutSupport::mapRectToSVGRootForPaintInvalidation(const LayoutObject& object, const FloatRect& localPaintInvalidationRect, LayoutRect& rect)
{
- ASSERT(object && object->isSVG() && !object->isSVGRoot());
+ ASSERT(object.isSVG() && !object.isSVGRoot());
FloatRect paintInvalidationRect = localPaintInvalidationRect;
// FIXME: Building the transform to the SVG root border box and then doing
// mapRect() with that would be slightly more efficient, but requires some
// additions to AffineTransform (preMultiply, preTranslate) to avoid
// excessive copying and to get a similar fast-path for translations.
- const LayoutObject* parent = object;
+ const LayoutObject* parent = &object;
do {
paintInvalidationRect = parent->localToParentTransform().mapRect(paintInvalidationRect);
parent = parent->parent();
« no previous file with comments | « Source/core/layout/svg/SVGLayoutSupport.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698