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

Side by Side 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 unified diff | 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 »
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 67
68 void LayoutSVGShape::updateShapeFromElement() 68 void LayoutSVGShape::updateShapeFromElement()
69 { 69 {
70 createPath(); 70 createPath();
71 71
72 m_fillBoundingBox = calculateObjectBoundingBox(); 72 m_fillBoundingBox = calculateObjectBoundingBox();
73 m_strokeBoundingBox = calculateStrokeBoundingBox(); 73 m_strokeBoundingBox = calculateStrokeBoundingBox();
74 } 74 }
75 75
76 FloatRect LayoutSVGShape::hitTestStrokeBoundingBox() const
77 {
78 if (style()->svgStyle().hasStroke())
79 return m_strokeBoundingBox;
80
81 // Implementation of http://dev.w3.org/fxtf/css-masking-1/#compute-stroke-bo unding-box
82 // for the <rect> / <ellipse> / <circle> case except that we ignore whether
83 // the stroke is none.
84
85 FloatRect box = m_fillBoundingBox;
86 const float strokeWidth = this->strokeWidth();
87 box.inflate(strokeWidth / 2);
88 return box;
89 }
90
76 bool LayoutSVGShape::shapeDependentStrokeContains(const FloatPoint& point) 91 bool LayoutSVGShape::shapeDependentStrokeContains(const FloatPoint& point)
77 { 92 {
78 ASSERT(m_path); 93 ASSERT(m_path);
79 StrokeData strokeData; 94 StrokeData strokeData;
80 SVGLayoutSupport::applyStrokeStyleToStrokeData(strokeData, styleRef(), *this ); 95 SVGLayoutSupport::applyStrokeStyleToStrokeData(strokeData, styleRef(), *this );
81 96
82 if (hasNonScalingStroke()) { 97 if (hasNonScalingStroke()) {
83 AffineTransform nonScalingTransform = nonScalingStrokeTransform(); 98 AffineTransform nonScalingTransform = nonScalingStrokeTransform();
84 Path* usePath = nonScalingStrokePath(m_path.get(), nonScalingTransform); 99 Path* usePath = nonScalingStrokePath(m_path.get(), nonScalingTransform);
85 100
(...skipping 14 matching lines...) Expand all
100 return false; 115 return false;
101 116
102 if (requiresFill && !SVGPaintServer::existsForLayoutObject(*this, styleRef() , ApplyToFillMode)) 117 if (requiresFill && !SVGPaintServer::existsForLayoutObject(*this, styleRef() , ApplyToFillMode))
103 return false; 118 return false;
104 119
105 return shapeDependentFillContains(point, fillRule); 120 return shapeDependentFillContains(point, fillRule);
106 } 121 }
107 122
108 bool LayoutSVGShape::strokeContains(const FloatPoint& point, bool requiresStroke ) 123 bool LayoutSVGShape::strokeContains(const FloatPoint& point, bool requiresStroke )
109 { 124 {
110 if (!strokeBoundingBox().contains(point)) 125 if (requiresStroke) {
111 return false; 126 if (!strokeBoundingBox().contains(point))
127 return false;
112 128
113 if (requiresStroke && !SVGPaintServer::existsForLayoutObject(*this, styleRef (), ApplyToStrokeMode)) 129 if (!SVGPaintServer::existsForLayoutObject(*this, styleRef(), ApplyToStr okeMode))
114 return false; 130 return false;
131 } else {
132 if (!hitTestStrokeBoundingBox().contains(point))
133 return false;
134 }
115 135
116 return shapeDependentStrokeContains(point); 136 return shapeDependentStrokeContains(point);
117 } 137 }
118 138
119 void LayoutSVGShape::updateLocalTransform() 139 void LayoutSVGShape::updateLocalTransform()
120 { 140 {
121 SVGGraphicsElement* graphicsElement = toSVGGraphicsElement(element()); 141 SVGGraphicsElement* graphicsElement = toSVGGraphicsElement(element());
122 if (graphicsElement->hasAnimatedLocalTransform()) { 142 if (graphicsElement->hasAnimatedLocalTransform()) {
123 if (m_localTransform) 143 if (m_localTransform)
124 m_localTransform->setTransform(graphicsElement->calculateAnimatedLoc alTransform()); 144 m_localTransform->setTransform(graphicsElement->calculateAnimatedLoc alTransform());
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 SVGLayoutSupport::intersectPaintInvalidationRectWithResources(this, m_paintI nvalidationBoundingBox); 280 SVGLayoutSupport::intersectPaintInvalidationRectWithResources(this, m_paintI nvalidationBoundingBox);
261 } 281 }
262 282
263 float LayoutSVGShape::strokeWidth() const 283 float LayoutSVGShape::strokeWidth() const
264 { 284 {
265 SVGLengthContext lengthContext(element()); 285 SVGLengthContext lengthContext(element());
266 return lengthContext.valueForLength(style()->svgStyle().strokeWidth()); 286 return lengthContext.valueForLength(style()->svgStyle().strokeWidth());
267 } 287 }
268 288
269 } 289 }
OLDNEW
« 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