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

Unified Diff: Source/core/rendering/svg/SVGPathData.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/RenderSVGRect.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/SVGPathData.cpp
diff --git a/Source/core/rendering/svg/SVGPathData.cpp b/Source/core/rendering/svg/SVGPathData.cpp
index adafc73821f44f5f37f115fe461c89ffe595e191..b35768ddb6f53337c6f6fe6a0ee92e289d727814 100644
--- a/Source/core/rendering/svg/SVGPathData.cpp
+++ b/Source/core/rendering/svg/SVGPathData.cpp
@@ -50,11 +50,14 @@ static void updatePathFromEllipseElement(SVGElement* element, Path& path)
SVGLengthContext lengthContext(element);
float rx = ellipse->rx()->currentValue()->value(lengthContext);
- if (rx <= 0)
+ if (rx < 0)
return;
float ry = ellipse->ry()->currentValue()->value(lengthContext);
- if (ry <= 0)
+ if (ry < 0)
return;
+ if (!rx && !ry)
+ return;
+
path.addEllipse(FloatRect(ellipse->cx()->currentValue()->value(lengthContext) - rx, ellipse->cy()->currentValue()->value(lengthContext) - ry, rx * 2, ry * 2));
}
@@ -100,10 +103,12 @@ static void updatePathFromRectElement(SVGElement* element, Path& path)
SVGLengthContext lengthContext(element);
float width = rect->width()->currentValue()->value(lengthContext);
- if (width <= 0)
+ if (width < 0)
return;
float height = rect->height()->currentValue()->value(lengthContext);
- if (height <= 0)
+ if (height < 0)
+ return;
+ if (!width && !height)
return;
float x = rect->x()->currentValue()->value(lengthContext);
float y = rect->y()->currentValue()->value(lengthContext);
« no previous file with comments | « Source/core/rendering/svg/RenderSVGRect.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698