Chromium Code Reviews| Index: Source/core/rendering/svg/RenderSVGPath.cpp |
| diff --git a/Source/core/rendering/svg/RenderSVGPath.cpp b/Source/core/rendering/svg/RenderSVGPath.cpp |
| index a6344ec8aeae9892b7eb8c974b7cec8464798d1b..66a7db301f5e00c74d89031a3454ab104a832303 100644 |
| --- a/Source/core/rendering/svg/RenderSVGPath.cpp |
| +++ b/Source/core/rendering/svg/RenderSVGPath.cpp |
| @@ -49,24 +49,33 @@ RenderSVGPath::~RenderSVGPath() |
| void RenderSVGPath::updateShapeFromElement() |
| { |
| RenderSVGShape::updateShapeFromElement(); |
| - updateZeroLengthSubpaths(); |
| - m_strokeBoundingBox = calculateUpdatedStrokeBoundingBox(); |
| + FloatRect markerRect; |
| + if (m_markerPositions.isEmpty()) { |
|
fs
2015/01/22 12:15:58
The if-branch is a no-op, so suggest reversing thi
|
| + markerRect = FloatRect(); |
| + } else { |
| + markerRect = this->markerRect(strokeWidth()); |
| + m_hitTestStrokeBoundingBox.unite(markerRect); |
|
fs
2015/01/22 12:15:58
IIRC markers are not included in the hit test, so
|
| + } |
| + |
| + updateZeroLengthSubpaths(); |
| + m_hitTestStrokeBoundingBox = calculateUpdatedHitTestStrokeBoundingBox(); |
| + if (style()->svgStyle().hasStroke()) { |
| + m_strokeBoundingBox = m_hitTestStrokeBoundingBox; |
| + } else { |
| + m_strokeBoundingBox = m_fillBoundingBox; |
| + m_strokeBoundingBox.unite(markerRect); |
| + } |
| } |
| -FloatRect RenderSVGPath::calculateUpdatedStrokeBoundingBox() const |
| +FloatRect RenderSVGPath::calculateUpdatedHitTestStrokeBoundingBox() const |
| { |
| - FloatRect strokeBoundingBox = m_strokeBoundingBox; |
| - |
| - if (!m_markerPositions.isEmpty()) |
| - strokeBoundingBox.unite(markerRect(strokeWidth())); |
| + FloatRect strokeBoundingBox = m_hitTestStrokeBoundingBox; |
| - if (style()->svgStyle().hasStroke()) { |
| - // FIXME: zero-length subpaths do not respect vector-effect = non-scaling-stroke. |
| - float strokeWidth = this->strokeWidth(); |
| - for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) |
| - strokeBoundingBox.unite(zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeWidth)); |
| - } |
| + // FIXME: zero-length subpaths do not respect vector-effect = non-scaling-stroke. |
| + const float strokeWidth = this->strokeWidth(); |
| + for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) |
| + strokeBoundingBox.unite(zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeWidth)); |
| return strokeBoundingBox; |
| } |
| @@ -77,9 +86,9 @@ bool RenderSVGPath::shapeDependentStrokeContains(const FloatPoint& point) |
| return true; |
| const SVGRenderStyle& svgStyle = style()->svgStyle(); |
| + const float strokeWidth = this->strokeWidth(); |
| for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) { |
| ASSERT(svgStyle.hasStroke()); |
| - float strokeWidth = this->strokeWidth(); |
| if (svgStyle.capStyle() == SquareCap) { |
| if (zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeWidth).contains(point)) |
| return true; |