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

Unified Diff: Source/core/layout/svg/LayoutSVGShape.cpp

Issue 1048043002: Fix pointer-events:all when stroke="none" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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/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);
}
« Source/core/layout/svg/LayoutSVGPath.cpp ('K') | « Source/core/layout/svg/LayoutSVGShape.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698