Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1507)

Unified Diff: Source/core/rendering/svg/RenderSVGShape.cpp

Issue 810343003: Fix pointer-events:all when stroke="none" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add back m_strokeBoundingBox Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..26f5578f998b3d1b3e5094bbf68428bf03fa190f 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,8 +102,13 @@ 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;
+ } else {
+ if (!hitTestStrokeBoundingBox().contains(point))
+ return false;
+ }
if (requiresStroke && !SVGPaintServer::existsForRenderer(*this, style(), ApplyToStrokeMode))
fs 2015/01/22 12:15:58 Suggest you move this into the commonly predicated
return false;
@@ -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;
« Source/core/rendering/svg/RenderSVGPath.cpp ('K') | « Source/core/rendering/svg/RenderSVGShape.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698