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

Side by Side Diff: Source/core/rendering/svg/RenderSVGShape.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/RenderSVGShape.h ('k') | no next file » | 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 void RenderSVGShape::updateShapeFromElement() 57 void RenderSVGShape::updateShapeFromElement()
58 { 58 {
59 m_path.clear(); 59 m_path.clear();
60 m_path = adoptPtr(new Path); 60 m_path = adoptPtr(new Path);
61 ASSERT(RenderSVGShape::isShapeEmpty()); 61 ASSERT(RenderSVGShape::isShapeEmpty());
62 62
63 updatePathFromGraphicsElement(toSVGGraphicsElement(element()), path()); 63 updatePathFromGraphicsElement(toSVGGraphicsElement(element()), path());
64 processMarkerPositions(); 64 processMarkerPositions();
65 65
66 m_fillBoundingBox = calculateObjectBoundingBox(); 66 m_fillBoundingBox = calculateObjectBoundingBox();
67 m_hitTestStrokeBoundingBox = calculateHitTestStrokeBoundingBox(); 67 m_strokeBoundingBox = calculateStrokeBoundingBox();
68 m_strokeBoundingBox = style()->svgStyle().hasStroke() ? m_hitTestStrokeBound ingBox : m_fillBoundingBox;
69 } 68 }
70 69
71 bool RenderSVGShape::shapeDependentStrokeContains(const FloatPoint& point) 70 bool RenderSVGShape::shapeDependentStrokeContains(const FloatPoint& point)
72 { 71 {
73 ASSERT(m_path); 72 ASSERT(m_path);
74 StrokeData strokeData; 73 StrokeData strokeData;
75 SVGRenderSupport::applyStrokeStyleToStrokeData(&strokeData, style(), this); 74 SVGRenderSupport::applyStrokeStyleToStrokeData(&strokeData, style(), this);
76 75
77 if (hasNonScalingStroke()) { 76 if (hasNonScalingStroke()) {
78 AffineTransform nonScalingTransform = nonScalingStrokeTransform(); 77 AffineTransform nonScalingTransform = nonScalingStrokeTransform();
(...skipping 16 matching lines...) Expand all
95 return false; 94 return false;
96 95
97 if (requiresFill && !SVGPaintServer::existsForRenderer(*this, style(), Apply ToFillMode)) 96 if (requiresFill && !SVGPaintServer::existsForRenderer(*this, style(), Apply ToFillMode))
98 return false; 97 return false;
99 98
100 return shapeDependentFillContains(point, fillRule); 99 return shapeDependentFillContains(point, fillRule);
101 } 100 }
102 101
103 bool RenderSVGShape::strokeContains(const FloatPoint& point, bool requiresStroke ) 102 bool RenderSVGShape::strokeContains(const FloatPoint& point, bool requiresStroke )
104 { 103 {
105 if (requiresStroke) { 104 if (!strokeBoundingBox().contains(point))
106 if (!strokeBoundingBox().contains(point)) 105 return false;
107 return false;
108 106
109 if (!SVGPaintServer::existsForRenderer(*this, style(), ApplyToStrokeMode )) 107 if (requiresStroke && !SVGPaintServer::existsForRenderer(*this, style(), App lyToStrokeMode))
110 return false; 108 return false;
111 } else {
112 if (!hitTestStrokeBoundingBox().contains(point))
113 return false;
114 }
115 109
116 return shapeDependentStrokeContains(point); 110 return shapeDependentStrokeContains(point);
117 } 111 }
118 112
119 void RenderSVGShape::updateLocalTransform() 113 void RenderSVGShape::updateLocalTransform()
120 { 114 {
121 SVGGraphicsElement* graphicsElement = toSVGGraphicsElement(element()); 115 SVGGraphicsElement* graphicsElement = toSVGGraphicsElement(element());
122 if (graphicsElement->hasAnimatedLocalTransform()) { 116 if (graphicsElement->hasAnimatedLocalTransform()) {
123 if (m_localTransform) 117 if (m_localTransform)
124 m_localTransform->setTransform(graphicsElement->calculateAnimatedLoc alTransform()); 118 m_localTransform->setTransform(graphicsElement->calculateAnimatedLoc alTransform());
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 return true; 214 return true;
221 } 215 }
222 return false; 216 return false;
223 } 217 }
224 218
225 FloatRect RenderSVGShape::calculateObjectBoundingBox() const 219 FloatRect RenderSVGShape::calculateObjectBoundingBox() const
226 { 220 {
227 return path().boundingRect(); 221 return path().boundingRect();
228 } 222 }
229 223
230 FloatRect RenderSVGShape::calculateHitTestStrokeBoundingBox() const 224 FloatRect RenderSVGShape::calculateStrokeBoundingBox() const
231 { 225 {
232 ASSERT(m_path); 226 ASSERT(m_path);
233 FloatRect strokeBoundingBox = m_fillBoundingBox; 227 FloatRect strokeBoundingBox = m_fillBoundingBox;
234 228
235 StrokeData strokeData; 229 if (style()->svgStyle().hasStroke()) {
236 SVGRenderSupport::applyStrokeStyleToStrokeData(&strokeData, style(), this); 230 StrokeData strokeData;
237 if (hasNonScalingStroke()) { 231 SVGRenderSupport::applyStrokeStyleToStrokeData(&strokeData, style(), thi s);
238 AffineTransform nonScalingTransform = nonScalingStrokeTransform(); 232 if (hasNonScalingStroke()) {
239 if (nonScalingTransform.isInvertible()) { 233 AffineTransform nonScalingTransform = nonScalingStrokeTransform();
240 Path* usePath = nonScalingStrokePath(m_path.get(), nonScalingTransfo rm); 234 if (nonScalingTransform.isInvertible()) {
241 FloatRect strokeBoundingRect = usePath->strokeBoundingRect(strokeDat a); 235 Path* usePath = nonScalingStrokePath(m_path.get(), nonScalingTra nsform);
242 strokeBoundingRect = nonScalingTransform.inverse().mapRect(strokeBou ndingRect); 236 FloatRect strokeBoundingRect = usePath->strokeBoundingRect(strok eData);
243 strokeBoundingBox.unite(strokeBoundingRect); 237 strokeBoundingRect = nonScalingTransform.inverse().mapRect(strok eBoundingRect);
238 strokeBoundingBox.unite(strokeBoundingRect);
239 }
240 } else {
241 strokeBoundingBox.unite(path().strokeBoundingRect(strokeData));
244 } 242 }
245 } else {
246 strokeBoundingBox.unite(path().strokeBoundingRect(strokeData));
247 } 243 }
248 244
249 return strokeBoundingBox; 245 return strokeBoundingBox;
250 } 246 }
251 247
252 void RenderSVGShape::updatePaintInvalidationBoundingBox() 248 void RenderSVGShape::updatePaintInvalidationBoundingBox()
253 { 249 {
254 m_paintInvalidationBoundingBox = strokeBoundingBox(); 250 m_paintInvalidationBoundingBox = strokeBoundingBox();
255 if (strokeWidth() < 1.0f && !m_paintInvalidationBoundingBox.isEmpty()) 251 if (strokeWidth() < 1.0f && !m_paintInvalidationBoundingBox.isEmpty())
256 m_paintInvalidationBoundingBox.inflate(1); 252 m_paintInvalidationBoundingBox.inflate(1);
257 SVGRenderSupport::intersectPaintInvalidationRectWithResources(this, m_paintI nvalidationBoundingBox); 253 SVGRenderSupport::intersectPaintInvalidationRectWithResources(this, m_paintI nvalidationBoundingBox);
258 } 254 }
259 255
260 float RenderSVGShape::strokeWidth() const 256 float RenderSVGShape::strokeWidth() const
261 { 257 {
262 SVGLengthContext lengthContext(element()); 258 SVGLengthContext lengthContext(element());
263 return style()->svgStyle().strokeWidth()->value(lengthContext); 259 return style()->svgStyle().strokeWidth()->value(lengthContext);
264 } 260 }
265 261
266 } 262 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGShape.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698