| 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..12e391fa7065ffa7829a706f52b5afa98e80db7d 100644
|
| --- a/Source/core/rendering/svg/RenderSVGShape.cpp
|
| +++ b/Source/core/rendering/svg/RenderSVGShape.cpp
|
| @@ -64,7 +64,8 @@ void RenderSVGShape::updateShapeFromElement()
|
| processMarkerPositions();
|
|
|
| m_fillBoundingBox = calculateObjectBoundingBox();
|
| - m_strokeBoundingBox = calculateStrokeBoundingBox();
|
| + m_hitTestStrokeBoundingBox = calculateHitTestStrokeBoundingBox();
|
| + m_strokeBoundingBox = style()->svgStyle().hasStroke() ? m_hitTestStrokeBoundingBox : m_fillBoundingBox;
|
| }
|
|
|
| bool RenderSVGShape::shapeDependentStrokeContains(const FloatPoint& point)
|
| @@ -101,11 +102,16 @@ bool RenderSVGShape::fillContains(const FloatPoint& point, bool requiresFill, co
|
|
|
| bool RenderSVGShape::strokeContains(const FloatPoint& point, bool requiresStroke)
|
| {
|
| - if (!strokeBoundingBox().contains(point))
|
| - return false;
|
| + if (requiresStroke) {
|
| + if (!strokeBoundingBox().contains(point))
|
| + return false;
|
|
|
| - if (requiresStroke && !SVGPaintServer::existsForRenderer(*this, style(), ApplyToStrokeMode))
|
| - return false;
|
| + if (!SVGPaintServer::existsForRenderer(*this, style(), ApplyToStrokeMode))
|
| + return false;
|
| + } else {
|
| + if (!hitTestStrokeBoundingBox().contains(point))
|
| + return false;
|
| + }
|
|
|
| return shapeDependentStrokeContains(point);
|
| }
|
| @@ -221,25 +227,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;
|
|
|