Chromium Code Reviews| Index: Source/core/rendering/svg/RenderSVGShape.cpp |
| diff --git a/Source/core/rendering/svg/RenderSVGShape.cpp b/Source/core/rendering/svg/RenderSVGShape.cpp |
| index 92e822d3146ad2acb68869289c1cf5e0e26301bc..0619a7f95b45d2756c95239efbc19198d58f78b5 100644 |
| --- a/Source/core/rendering/svg/RenderSVGShape.cpp |
| +++ b/Source/core/rendering/svg/RenderSVGShape.cpp |
| @@ -64,7 +64,7 @@ void RenderSVGShape::updateShapeFromElement() |
| processMarkerPositions(); |
| m_fillBoundingBox = calculateObjectBoundingBox(); |
| - m_strokeBoundingBox = calculateStrokeBoundingBox(); |
| + m_hitTestStrokeBoundingBox = calculateHitTestStrokeBoundingBox(); |
| } |
| bool RenderSVGShape::shapeDependentStrokeContains(const FloatPoint& point) |
| @@ -101,7 +101,7 @@ bool RenderSVGShape::fillContains(const FloatPoint& point, bool requiresFill, co |
| bool RenderSVGShape::strokeContains(const FloatPoint& point, bool requiresStroke) |
| { |
| - if (!strokeBoundingBox().contains(point)) |
| + if (!(requiresStroke ? strokeBoundingBox() : m_hitTestStrokeBoundingBox).contains(point)) |
|
fs
2015/01/12 13:00:04
Not particularly fond of this construct... Feels l
|
| return false; |
| if (requiresStroke && !SVGPaintServer::existsForRenderer(*this, style(), ApplyToStrokeMode)) |
| @@ -221,25 +221,23 @@ FloatRect RenderSVGShape::calculateObjectBoundingBox() const |
| return path().boundingRect(); |
| } |
| -FloatRect RenderSVGShape::calculateStrokeBoundingBox() const |
| +FloatRect RenderSVGShape::calculateHitTestStrokeBoundingBox() const |
| { |
| ASSERT(m_path); |
| FloatRect strokeBoundingBox = m_fillBoundingBox; |
| - if (style()->svgStyle().hasStroke()) { |
| - StrokeData strokeData; |
| - SVGRenderSupport::applyStrokeStyleToStrokeData(&strokeData, style(), this); |
| - if (hasNonScalingStroke()) { |
| - AffineTransform nonScalingTransform = nonScalingStrokeTransform(); |
| - if (nonScalingTransform.isInvertible()) { |
| - Path* usePath = nonScalingStrokePath(m_path.get(), nonScalingTransform); |
| - FloatRect strokeBoundingRect = usePath->strokeBoundingRect(strokeData); |
| - strokeBoundingRect = nonScalingTransform.inverse().mapRect(strokeBoundingRect); |
| - strokeBoundingBox.unite(strokeBoundingRect); |
| - } |
| - } else { |
| - strokeBoundingBox.unite(path().strokeBoundingRect(strokeData)); |
| + StrokeData strokeData; |
| + SVGRenderSupport::applyStrokeStyleToStrokeData(&strokeData, style(), this); |
| + if (hasNonScalingStroke()) { |
| + AffineTransform nonScalingTransform = nonScalingStrokeTransform(); |
| + if (nonScalingTransform.isInvertible()) { |
| + Path* usePath = nonScalingStrokePath(m_path.get(), nonScalingTransform); |
| + FloatRect strokeBoundingRect = usePath->strokeBoundingRect(strokeData); |
| + strokeBoundingRect = nonScalingTransform.inverse().mapRect(strokeBoundingRect); |
| + strokeBoundingBox.unite(strokeBoundingRect); |
| } |
| + } else { |
| + strokeBoundingBox.unite(path().strokeBoundingRect(strokeData)); |
| } |
| return strokeBoundingBox; |