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

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

Issue 810343003: Fix pointer-events:all when stroke="none" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rename m_strokeBoundingBox to m_hitTestStrokeBoundingBox 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_strokeBoundingBox = calculateStrokeBoundingBox(); 67 m_hitTestStrokeBoundingBox = calculateHitTestStrokeBoundingBox();
68 } 68 }
69 69
70 bool RenderSVGShape::shapeDependentStrokeContains(const FloatPoint& point) 70 bool RenderSVGShape::shapeDependentStrokeContains(const FloatPoint& point)
71 { 71 {
72 ASSERT(m_path); 72 ASSERT(m_path);
73 StrokeData strokeData; 73 StrokeData strokeData;
74 SVGRenderSupport::applyStrokeStyleToStrokeData(&strokeData, style(), this); 74 SVGRenderSupport::applyStrokeStyleToStrokeData(&strokeData, style(), this);
75 75
76 if (hasNonScalingStroke()) { 76 if (hasNonScalingStroke()) {
77 AffineTransform nonScalingTransform = nonScalingStrokeTransform(); 77 AffineTransform nonScalingTransform = nonScalingStrokeTransform();
(...skipping 16 matching lines...) Expand all
94 return false; 94 return false;
95 95
96 if (requiresFill && !SVGPaintServer::existsForRenderer(*this, style(), Apply ToFillMode)) 96 if (requiresFill && !SVGPaintServer::existsForRenderer(*this, style(), Apply ToFillMode))
97 return false; 97 return false;
98 98
99 return shapeDependentFillContains(point, fillRule); 99 return shapeDependentFillContains(point, fillRule);
100 } 100 }
101 101
102 bool RenderSVGShape::strokeContains(const FloatPoint& point, bool requiresStroke ) 102 bool RenderSVGShape::strokeContains(const FloatPoint& point, bool requiresStroke )
103 { 103 {
104 if (!strokeBoundingBox().contains(point)) 104 if (!(requiresStroke ? strokeBoundingBox() : m_hitTestStrokeBoundingBox).con tains(point))
fs 2015/01/12 13:00:04 Not particularly fond of this construct... Feels l
105 return false; 105 return false;
106 106
107 if (requiresStroke && !SVGPaintServer::existsForRenderer(*this, style(), App lyToStrokeMode)) 107 if (requiresStroke && !SVGPaintServer::existsForRenderer(*this, style(), App lyToStrokeMode))
108 return false; 108 return false;
109 109
110 return shapeDependentStrokeContains(point); 110 return shapeDependentStrokeContains(point);
111 } 111 }
112 112
113 void RenderSVGShape::updateLocalTransform() 113 void RenderSVGShape::updateLocalTransform()
114 { 114 {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 return true; 214 return true;
215 } 215 }
216 return false; 216 return false;
217 } 217 }
218 218
219 FloatRect RenderSVGShape::calculateObjectBoundingBox() const 219 FloatRect RenderSVGShape::calculateObjectBoundingBox() const
220 { 220 {
221 return path().boundingRect(); 221 return path().boundingRect();
222 } 222 }
223 223
224 FloatRect RenderSVGShape::calculateStrokeBoundingBox() const 224 FloatRect RenderSVGShape::calculateHitTestStrokeBoundingBox() const
225 { 225 {
226 ASSERT(m_path); 226 ASSERT(m_path);
227 FloatRect strokeBoundingBox = m_fillBoundingBox; 227 FloatRect strokeBoundingBox = m_fillBoundingBox;
228 228
229 if (style()->svgStyle().hasStroke()) { 229 StrokeData strokeData;
230 StrokeData strokeData; 230 SVGRenderSupport::applyStrokeStyleToStrokeData(&strokeData, style(), this);
231 SVGRenderSupport::applyStrokeStyleToStrokeData(&strokeData, style(), thi s); 231 if (hasNonScalingStroke()) {
232 if (hasNonScalingStroke()) { 232 AffineTransform nonScalingTransform = nonScalingStrokeTransform();
233 AffineTransform nonScalingTransform = nonScalingStrokeTransform(); 233 if (nonScalingTransform.isInvertible()) {
234 if (nonScalingTransform.isInvertible()) { 234 Path* usePath = nonScalingStrokePath(m_path.get(), nonScalingTransfo rm);
235 Path* usePath = nonScalingStrokePath(m_path.get(), nonScalingTra nsform); 235 FloatRect strokeBoundingRect = usePath->strokeBoundingRect(strokeDat a);
236 FloatRect strokeBoundingRect = usePath->strokeBoundingRect(strok eData); 236 strokeBoundingRect = nonScalingTransform.inverse().mapRect(strokeBou ndingRect);
237 strokeBoundingRect = nonScalingTransform.inverse().mapRect(strok eBoundingRect); 237 strokeBoundingBox.unite(strokeBoundingRect);
238 strokeBoundingBox.unite(strokeBoundingRect);
239 }
240 } else {
241 strokeBoundingBox.unite(path().strokeBoundingRect(strokeData));
242 } 238 }
239 } else {
240 strokeBoundingBox.unite(path().strokeBoundingRect(strokeData));
243 } 241 }
244 242
245 return strokeBoundingBox; 243 return strokeBoundingBox;
246 } 244 }
247 245
248 void RenderSVGShape::updatePaintInvalidationBoundingBox() 246 void RenderSVGShape::updatePaintInvalidationBoundingBox()
249 { 247 {
250 m_paintInvalidationBoundingBox = strokeBoundingBox(); 248 m_paintInvalidationBoundingBox = strokeBoundingBox();
251 if (strokeWidth() < 1.0f && !m_paintInvalidationBoundingBox.isEmpty()) 249 if (strokeWidth() < 1.0f && !m_paintInvalidationBoundingBox.isEmpty())
252 m_paintInvalidationBoundingBox.inflate(1); 250 m_paintInvalidationBoundingBox.inflate(1);
253 SVGRenderSupport::intersectPaintInvalidationRectWithResources(this, m_paintI nvalidationBoundingBox); 251 SVGRenderSupport::intersectPaintInvalidationRectWithResources(this, m_paintI nvalidationBoundingBox);
254 } 252 }
255 253
256 float RenderSVGShape::strokeWidth() const 254 float RenderSVGShape::strokeWidth() const
257 { 255 {
258 SVGLengthContext lengthContext(element()); 256 SVGLengthContext lengthContext(element());
259 return style()->svgStyle().strokeWidth()->value(lengthContext); 257 return style()->svgStyle().strokeWidth()->value(lengthContext);
260 } 258 }
261 259
262 } 260 }
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