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

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: Rebase Created 5 years, 8 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
« no previous file with comments | « Source/core/layout/svg/LayoutSVGShape.h ('k') | Source/core/style/SVGComputedStyle.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/svg/LayoutSVGShape.cpp
diff --git a/Source/core/layout/svg/LayoutSVGShape.cpp b/Source/core/layout/svg/LayoutSVGShape.cpp
index 1b11b2e6e9ca6fde8a8952357f5d7d916e3a06f1..a6fbe09b903bd51414996ef4e0b9543b44599122 100644
--- a/Source/core/layout/svg/LayoutSVGShape.cpp
+++ b/Source/core/layout/svg/LayoutSVGShape.cpp
@@ -73,6 +73,21 @@ void LayoutSVGShape::updateShapeFromElement()
m_strokeBoundingBox = calculateStrokeBoundingBox();
}
+FloatRect LayoutSVGShape::hitTestStrokeBoundingBox() const
+{
+ if (style()->svgStyle().hasStroke())
+ return m_strokeBoundingBox;
+
+ // Implementation of http://dev.w3.org/fxtf/css-masking-1/#compute-stroke-bounding-box
+ // for the <rect> / <ellipse> / <circle> case except that we ignore whether
+ // the stroke is none.
+
+ FloatRect box = m_fillBoundingBox;
+ const float strokeWidth = this->strokeWidth();
+ box.inflate(strokeWidth / 2);
+ return box;
+}
+
bool LayoutSVGShape::shapeDependentStrokeContains(const FloatPoint& point)
{
ASSERT(m_path);
@@ -107,11 +122,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);
}
« no previous file with comments | « Source/core/layout/svg/LayoutSVGShape.h ('k') | Source/core/style/SVGComputedStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698