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

Unified Diff: Source/core/rendering/svg/RenderSVGRect.cpp

Issue 307643003: Don't render empty shapes with non-scaling-stroke (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update TEs. Created 6 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/rendering/svg/RenderSVGEllipse.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/svg/RenderSVGRect.cpp
diff --git a/Source/core/rendering/svg/RenderSVGRect.cpp b/Source/core/rendering/svg/RenderSVGRect.cpp
index efda77379dbd5ab36a5b81ff9cbf6669f6c096ec..523d7b4274093456117972c57528c57fe0300b62 100644
--- a/Source/core/rendering/svg/RenderSVGRect.cpp
+++ b/Source/core/rendering/svg/RenderSVGRect.cpp
@@ -54,20 +54,23 @@ void RenderSVGRect::updateShapeFromElement()
ASSERT(rect);
SVGLengthContext lengthContext(rect);
- // Fallback to RenderSVGShape if rect has rounded corners or a non-scaling stroke.
- if (rect->rx()->currentValue()->value(lengthContext) > 0 || rect->ry()->currentValue()->value(lengthContext) > 0 || hasNonScalingStroke()) {
- RenderSVGShape::updateShapeFromElement();
- m_usePathFallback = true;
- return;
- }
-
- m_usePathFallback = false;
FloatSize boundingBoxSize(rect->width()->currentValue()->value(lengthContext), rect->height()->currentValue()->value(lengthContext));
- // Spec: "A negative value is an error. A value of zero disables rendering of the element."
- if (boundingBoxSize.isZero() || boundingBoxSize.width() < 0 || boundingBoxSize.height() < 0)
+ // Spec: "A negative value is an error."
+ if (boundingBoxSize.width() < 0 || boundingBoxSize.height() < 0)
return;
+ // Spec: "A value of zero disables rendering of the element."
+ if (!boundingBoxSize.isEmpty()) {
+ // Fallback to RenderSVGShape if rect has rounded corners or a non-scaling stroke.
+ if (rect->rx()->currentValue()->value(lengthContext) > 0 || rect->ry()->currentValue()->value(lengthContext) > 0 || hasNonScalingStroke()) {
+ RenderSVGShape::updateShapeFromElement();
+ m_usePathFallback = true;
+ return;
+ }
+ m_usePathFallback = false;
+ }
+
m_fillBoundingBox = FloatRect(FloatPoint(rect->x()->currentValue()->value(lengthContext), rect->y()->currentValue()->value(lengthContext)), boundingBoxSize);
// To decide if the stroke contains a point we create two rects which represent the inner and
« no previous file with comments | « Source/core/rendering/svg/RenderSVGEllipse.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698