Chromium Code Reviews| 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..7f04bf93de62c87412baa56c9dca2702e14e2283 100644 |
| --- a/Source/core/rendering/svg/RenderSVGRect.cpp |
| +++ b/Source/core/rendering/svg/RenderSVGRect.cpp |
| @@ -55,25 +55,29 @@ void RenderSVGRect::updateShapeFromElement() |
| SVGLengthContext lengthContext(rect); |
| // Fallback to RenderSVGShape if rect has rounded corners or a non-scaling stroke. |
| + m_usePathFallback = false; |
| 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)); |
| - 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); |
| + if (m_usePathFallback) |
| + return; |
| + |
| // To decide if the stroke contains a point we create two rects which represent the inner and |
| // the outer stroke borders. A stroke contains the point, if the point is between them. |
| m_innerStrokeRect = m_fillBoundingBox; |
| m_outerStrokeRect = m_fillBoundingBox; |
| - if (style()->svgStyle()->hasStroke()) { |
| + if (style()->svgStyle()->hasStroke() && boundingBoxSize.width() && boundingBoxSize.height()) { |
|
Stephen Chennney
2014/03/24 15:49:16
Same here.
|
| float strokeWidth = this->strokeWidth(); |
| m_innerStrokeRect.inflate(-strokeWidth / 2); |
| m_outerStrokeRect.inflate(strokeWidth / 2); |