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

Side by Side Diff: Source/core/rendering/svg/RenderSVGPath.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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2008 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2008 Rob Buis <buis@kde.org>
4 * Copyright (C) 2005, 2007 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2005, 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Google, Inc. 5 * Copyright (C) 2009 Google, Inc.
6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
8 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com> 8 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com>
9 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org> 9 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org>
10 * Copyright (C) 2011 University of Szeged 10 * Copyright (C) 2011 University of Szeged
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 { 42 {
43 } 43 }
44 44
45 RenderSVGPath::~RenderSVGPath() 45 RenderSVGPath::~RenderSVGPath()
46 { 46 {
47 } 47 }
48 48
49 void RenderSVGPath::updateShapeFromElement() 49 void RenderSVGPath::updateShapeFromElement()
50 { 50 {
51 RenderSVGShape::updateShapeFromElement(); 51 RenderSVGShape::updateShapeFromElement();
52
53 FloatRect markerRect;
54 if (m_markerPositions.isEmpty()) {
fs 2015/01/22 12:15:58 The if-branch is a no-op, so suggest reversing thi
55 markerRect = FloatRect();
56 } else {
57 markerRect = this->markerRect(strokeWidth());
58 m_hitTestStrokeBoundingBox.unite(markerRect);
fs 2015/01/22 12:15:58 IIRC markers are not included in the hit test, so
59 }
60
52 updateZeroLengthSubpaths(); 61 updateZeroLengthSubpaths();
53 62 m_hitTestStrokeBoundingBox = calculateUpdatedHitTestStrokeBoundingBox();
54 m_strokeBoundingBox = calculateUpdatedStrokeBoundingBox(); 63 if (style()->svgStyle().hasStroke()) {
64 m_strokeBoundingBox = m_hitTestStrokeBoundingBox;
65 } else {
66 m_strokeBoundingBox = m_fillBoundingBox;
67 m_strokeBoundingBox.unite(markerRect);
68 }
55 } 69 }
56 70
57 FloatRect RenderSVGPath::calculateUpdatedStrokeBoundingBox() const 71 FloatRect RenderSVGPath::calculateUpdatedHitTestStrokeBoundingBox() const
58 { 72 {
59 FloatRect strokeBoundingBox = m_strokeBoundingBox; 73 FloatRect strokeBoundingBox = m_hitTestStrokeBoundingBox;
60 74
61 if (!m_markerPositions.isEmpty()) 75 // FIXME: zero-length subpaths do not respect vector-effect = non-scaling-st roke.
62 strokeBoundingBox.unite(markerRect(strokeWidth())); 76 const float strokeWidth = this->strokeWidth();
63 77 for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i)
64 if (style()->svgStyle().hasStroke()) { 78 strokeBoundingBox.unite(zeroLengthSubpathRect(m_zeroLengthLinecapLocatio ns[i], strokeWidth));
65 // FIXME: zero-length subpaths do not respect vector-effect = non-scalin g-stroke.
66 float strokeWidth = this->strokeWidth();
67 for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i)
68 strokeBoundingBox.unite(zeroLengthSubpathRect(m_zeroLengthLinecapLoc ations[i], strokeWidth));
69 }
70 79
71 return strokeBoundingBox; 80 return strokeBoundingBox;
72 } 81 }
73 82
74 bool RenderSVGPath::shapeDependentStrokeContains(const FloatPoint& point) 83 bool RenderSVGPath::shapeDependentStrokeContains(const FloatPoint& point)
75 { 84 {
76 if (RenderSVGShape::shapeDependentStrokeContains(point)) 85 if (RenderSVGShape::shapeDependentStrokeContains(point))
77 return true; 86 return true;
78 87
79 const SVGRenderStyle& svgStyle = style()->svgStyle(); 88 const SVGRenderStyle& svgStyle = style()->svgStyle();
89 const float strokeWidth = this->strokeWidth();
80 for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) { 90 for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) {
81 ASSERT(svgStyle.hasStroke()); 91 ASSERT(svgStyle.hasStroke());
82 float strokeWidth = this->strokeWidth();
83 if (svgStyle.capStyle() == SquareCap) { 92 if (svgStyle.capStyle() == SquareCap) {
84 if (zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeWid th).contains(point)) 93 if (zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeWid th).contains(point))
85 return true; 94 return true;
86 } else { 95 } else {
87 ASSERT(svgStyle.capStyle() == RoundCap); 96 ASSERT(svgStyle.capStyle() == RoundCap);
88 FloatPoint radiusVector(point.x() - m_zeroLengthLinecapLocations[i]. x(), point.y() - m_zeroLengthLinecapLocations[i].y()); 97 FloatPoint radiusVector(point.x() - m_zeroLengthLinecapLocations[i]. x(), point.y() - m_zeroLengthLinecapLocations[i].y());
89 if (radiusVector.lengthSquared() < strokeWidth * strokeWidth * .25f) 98 if (radiusVector.lengthSquared() < strokeWidth * strokeWidth * .25f)
90 return true; 99 return true;
91 } 100 }
92 } 101 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 ASSERT(resources); 173 ASSERT(resources);
165 174
166 RenderSVGResourceMarker* markerStart = resources->markerStart(); 175 RenderSVGResourceMarker* markerStart = resources->markerStart();
167 176
168 SVGMarkerData markerData(m_markerPositions, markerStart ? markerStart->orien tType() == SVGMarkerOrientAutoStartReverse : false); 177 SVGMarkerData markerData(m_markerPositions, markerStart ? markerStart->orien tType() == SVGMarkerOrientAutoStartReverse : false);
169 path().apply(&markerData, SVGMarkerData::updateFromPathElement); 178 path().apply(&markerData, SVGMarkerData::updateFromPathElement);
170 markerData.pathIsDone(); 179 markerData.pathIsDone();
171 } 180 }
172 181
173 } 182 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698