Index: Source/core/layout/svg/LayoutSVGShape.cpp |
diff --git a/Source/core/layout/svg/LayoutSVGShape.cpp b/Source/core/layout/svg/LayoutSVGShape.cpp |
index 714f4a3cacc437da42d0598e0cc78e80792042ab..dda40e69aedd925aff43913368d595a50e7a36e2 100644 |
--- a/Source/core/layout/svg/LayoutSVGShape.cpp |
+++ b/Source/core/layout/svg/LayoutSVGShape.cpp |
@@ -73,6 +73,17 @@ void LayoutSVGShape::updateShapeFromElement() |
m_strokeBoundingBox = calculateStrokeBoundingBox(); |
} |
+FloatRect LayoutSVGShape::hitTestStrokeBoundingBox() const |
+{ |
+ if (style()->svgStyle().hasStroke()) |
+ return m_strokeBoundingBox; |
+ |
+ FloatRect result = m_fillBoundingBox; |
+ const float strokeWidth = this->strokeWidth(); |
+ result.inflate(strokeWidth / 2); |
+ return result; |
+} |
+ |
bool LayoutSVGShape::shapeDependentStrokeContains(const FloatPoint& point) |
{ |
ASSERT(m_path); |
@@ -107,11 +118,16 @@ bool LayoutSVGShape::fillContains(const FloatPoint& point, bool requiresFill, co |
bool LayoutSVGShape::strokeContains(const FloatPoint& point, bool requiresStroke) |
{ |
- if (!strokeBoundingBox().contains(point)) |
- return false; |
+ if (requiresStroke) { |
+ if (!strokeBoundingBox().contains(point)) |
+ return false; |
- if (requiresStroke && !SVGPaintServer::existsForLayoutObject(*this, styleRef(), ApplyToStrokeMode)) |
- return false; |
+ if (!SVGPaintServer::existsForLayoutObject(*this, styleRef(), ApplyToStrokeMode)) |
+ return false; |
+ } else { |
+ if (!hitTestStrokeBoundingBox().contains(point)) |
+ return false; |
+ } |
return shapeDependentStrokeContains(point); |
} |