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

Unified Diff: Source/core/rendering/svg/RenderSVGEllipse.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
Index: Source/core/rendering/svg/RenderSVGEllipse.cpp
diff --git a/Source/core/rendering/svg/RenderSVGEllipse.cpp b/Source/core/rendering/svg/RenderSVGEllipse.cpp
index bcd290028b12c6c03e958d032323cc9d88f77976..119f8bd7289a6af592ec0c0f47a15327dc9f641a 100644
--- a/Source/core/rendering/svg/RenderSVGEllipse.cpp
+++ b/Source/core/rendering/svg/RenderSVGEllipse.cpp
@@ -53,23 +53,26 @@ void RenderSVGEllipse::updateShapeFromElement()
m_center = FloatPoint();
m_radii = FloatSize();
+ m_usePathFallback = false;
// Fallback to RenderSVGShape if shape has a non-scaling stroke.
if (hasNonScalingStroke()) {
RenderSVGShape::updateShapeFromElement();
m_usePathFallback = true;
pdr. 2014/03/24 17:39:32 I'm afraid this part isn't right. Some background
jmunhoz 2014/03/24 18:51:24 On 2014/03/24 17:39:32, pdr wrote: [...]
- return;
- } else
- m_usePathFallback = false;
+ }
calculateRadiiAndCenter();
- // Spec: "A value of zero disables rendering of the element."
- if (m_radii.width() <= 0 || m_radii.height() <= 0)
+ // Spec: "A negative value is an error. A value of zero disables rendering of the element."
+ if (m_radii.isZero() || m_radii.width() < 0 || m_radii.height() < 0)
return;
m_fillBoundingBox = FloatRect(m_center.x() - m_radii.width(), m_center.y() - m_radii.height(), 2 * m_radii.width(), 2 * m_radii.height());
+
+ if (m_usePathFallback)
+ return;
+
m_strokeBoundingBox = m_fillBoundingBox;
- if (style()->svgStyle()->hasStroke())
+ if (style()->svgStyle()->hasStroke() && m_radii.width() && m_radii.height());
Stephen Chennney 2014/03/24 15:49:16 Typo? Does strokeWidth() depend on having non-zero
m_strokeBoundingBox.inflate(strokeWidth() / 2);
}

Powered by Google App Engine
This is Rietveld 408576698