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

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

Issue 208323007: Fix getBBox() returning (0,0) bug when width or height is zero (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@myzbackup
Patch Set: Created 6 years, 9 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') | Source/core/rendering/svg/SVGPathData.cpp » ('j') | 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 ce796422d932e7259436a049259b59167932f405..efda77379dbd5ab36a5b81ff9cbf6669f6c096ec 100644
--- a/Source/core/rendering/svg/RenderSVGRect.cpp
+++ b/Source/core/rendering/svg/RenderSVGRect.cpp
@@ -63,7 +63,9 @@ void RenderSVGRect::updateShapeFromElement()
m_usePathFallback = false;
FloatSize boundingBoxSize(rect->width()->currentValue()->value(lengthContext), rect->height()->currentValue()->value(lengthContext));
- if (boundingBoxSize.isEmpty())
+
+ // 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)
return;
m_fillBoundingBox = FloatRect(FloatPoint(rect->x()->currentValue()->value(lengthContext), rect->y()->currentValue()->value(lengthContext)), boundingBoxSize);
« no previous file with comments | « Source/core/rendering/svg/RenderSVGEllipse.cpp ('k') | Source/core/rendering/svg/SVGPathData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698