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

Side by Side Diff: Source/core/rendering/svg/RenderSVGPath.cpp

Issue 882443006: Revert of Fix pointer-events:all when stroke="none" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
« no previous file with comments | « Source/core/rendering/svg/RenderSVGPath.h ('k') | Source/core/rendering/svg/RenderSVGRect.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 updateZeroLengthSubpaths();
52 53
53 updateZeroLengthSubpaths(); 54 m_strokeBoundingBox = calculateUpdatedStrokeBoundingBox();
54 m_hitTestStrokeBoundingBox = calculateUpdatedHitTestStrokeBoundingBox();
55
56 m_strokeBoundingBox = style()->svgStyle().hasStroke() ? m_hitTestStrokeBound ingBox : m_fillBoundingBox;
57
58 if (!m_markerPositions.isEmpty()) {
59 const FloatRect markerRect = this->markerRect(strokeWidth());
60 m_strokeBoundingBox.unite(markerRect);
61 }
62 } 55 }
63 56
64 FloatRect RenderSVGPath::calculateUpdatedHitTestStrokeBoundingBox() const 57 FloatRect RenderSVGPath::calculateUpdatedStrokeBoundingBox() const
65 { 58 {
66 FloatRect strokeBoundingBox = m_hitTestStrokeBoundingBox; 59 FloatRect strokeBoundingBox = m_strokeBoundingBox;
67 60
68 // FIXME: zero-length subpaths do not respect vector-effect = non-scaling-st roke. 61 if (!m_markerPositions.isEmpty())
69 const float strokeWidth = this->strokeWidth(); 62 strokeBoundingBox.unite(markerRect(strokeWidth()));
70 for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) 63
71 strokeBoundingBox.unite(zeroLengthSubpathRect(m_zeroLengthLinecapLocatio ns[i], strokeWidth)); 64 if (style()->svgStyle().hasStroke()) {
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 }
72 70
73 return strokeBoundingBox; 71 return strokeBoundingBox;
74 } 72 }
75 73
76 bool RenderSVGPath::shapeDependentStrokeContains(const FloatPoint& point) 74 bool RenderSVGPath::shapeDependentStrokeContains(const FloatPoint& point)
77 { 75 {
78 if (RenderSVGShape::shapeDependentStrokeContains(point)) 76 if (RenderSVGShape::shapeDependentStrokeContains(point))
79 return true; 77 return true;
80 78
81 const SVGRenderStyle& svgStyle = style()->svgStyle(); 79 const SVGRenderStyle& svgStyle = style()->svgStyle();
82 const float strokeWidth = this->strokeWidth();
83 for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) { 80 for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) {
84 ASSERT(svgStyle.hasStroke()); 81 ASSERT(svgStyle.hasStroke());
82 float strokeWidth = this->strokeWidth();
85 if (svgStyle.capStyle() == SquareCap) { 83 if (svgStyle.capStyle() == SquareCap) {
86 if (zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeWid th).contains(point)) 84 if (zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeWid th).contains(point))
87 return true; 85 return true;
88 } else { 86 } else {
89 ASSERT(svgStyle.capStyle() == RoundCap); 87 ASSERT(svgStyle.capStyle() == RoundCap);
90 FloatPoint radiusVector(point.x() - m_zeroLengthLinecapLocations[i]. x(), point.y() - m_zeroLengthLinecapLocations[i].y()); 88 FloatPoint radiusVector(point.x() - m_zeroLengthLinecapLocations[i]. x(), point.y() - m_zeroLengthLinecapLocations[i].y());
91 if (radiusVector.lengthSquared() < strokeWidth * strokeWidth * .25f) 89 if (radiusVector.lengthSquared() < strokeWidth * strokeWidth * .25f)
92 return true; 90 return true;
93 } 91 }
94 } 92 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 ASSERT(resources); 164 ASSERT(resources);
167 165
168 RenderSVGResourceMarker* markerStart = resources->markerStart(); 166 RenderSVGResourceMarker* markerStart = resources->markerStart();
169 167
170 SVGMarkerData markerData(m_markerPositions, markerStart ? markerStart->orien tType() == SVGMarkerOrientAutoStartReverse : false); 168 SVGMarkerData markerData(m_markerPositions, markerStart ? markerStart->orien tType() == SVGMarkerOrientAutoStartReverse : false);
171 path().apply(&markerData, SVGMarkerData::updateFromPathElement); 169 path().apply(&markerData, SVGMarkerData::updateFromPathElement);
172 markerData.pathIsDone(); 170 markerData.pathIsDone();
173 } 171 }
174 172
175 } 173 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGPath.h ('k') | Source/core/rendering/svg/RenderSVGRect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698