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

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: 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
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 FloatRect result = m_fillBoundingBox;
82 const float strokeWidth = this->strokeWidth();
83 result.inflate(strokeWidth / 2);
84 return result;
85 }
86
76 bool LayoutSVGShape::shapeDependentStrokeContains(const FloatPoint& point) 87 bool LayoutSVGShape::shapeDependentStrokeContains(const FloatPoint& point)
77 { 88 {
78 ASSERT(m_path); 89 ASSERT(m_path);
79 StrokeData strokeData; 90 StrokeData strokeData;
80 SVGLayoutSupport::applyStrokeStyleToStrokeData(strokeData, styleRef(), *this ); 91 SVGLayoutSupport::applyStrokeStyleToStrokeData(strokeData, styleRef(), *this );
81 92
82 if (hasNonScalingStroke()) { 93 if (hasNonScalingStroke()) {
83 AffineTransform nonScalingTransform = nonScalingStrokeTransform(); 94 AffineTransform nonScalingTransform = nonScalingStrokeTransform();
84 Path* usePath = nonScalingStrokePath(m_path.get(), nonScalingTransform); 95 Path* usePath = nonScalingStrokePath(m_path.get(), nonScalingTransform);
85 96
(...skipping 14 matching lines...) Expand all
100 return false; 111 return false;
101 112
102 if (requiresFill && !SVGPaintServer::existsForLayoutObject(*this, styleRef() , ApplyToFillMode)) 113 if (requiresFill && !SVGPaintServer::existsForLayoutObject(*this, styleRef() , ApplyToFillMode))
103 return false; 114 return false;
104 115
105 return shapeDependentFillContains(point, fillRule); 116 return shapeDependentFillContains(point, fillRule);
106 } 117 }
107 118
108 bool LayoutSVGShape::strokeContains(const FloatPoint& point, bool requiresStroke ) 119 bool LayoutSVGShape::strokeContains(const FloatPoint& point, bool requiresStroke )
109 { 120 {
110 if (!strokeBoundingBox().contains(point)) 121 if (requiresStroke) {
111 return false; 122 if (!strokeBoundingBox().contains(point))
123 return false;
112 124
113 if (requiresStroke && !SVGPaintServer::existsForLayoutObject(*this, styleRef (), ApplyToStrokeMode)) 125 if (!SVGPaintServer::existsForLayoutObject(*this, styleRef(), ApplyToStr okeMode))
114 return false; 126 return false;
127 } else {
128 if (!hitTestStrokeBoundingBox().contains(point))
129 return false;
130 }
115 131
116 return shapeDependentStrokeContains(point); 132 return shapeDependentStrokeContains(point);
117 } 133 }
118 134
119 void LayoutSVGShape::updateLocalTransform() 135 void LayoutSVGShape::updateLocalTransform()
120 { 136 {
121 SVGGraphicsElement* graphicsElement = toSVGGraphicsElement(element()); 137 SVGGraphicsElement* graphicsElement = toSVGGraphicsElement(element());
122 if (graphicsElement->hasAnimatedLocalTransform()) { 138 if (graphicsElement->hasAnimatedLocalTransform()) {
123 if (m_localTransform) 139 if (m_localTransform)
124 m_localTransform->setTransform(graphicsElement->calculateAnimatedLoc alTransform()); 140 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); 276 SVGLayoutSupport::intersectPaintInvalidationRectWithResources(this, m_paintI nvalidationBoundingBox);
261 } 277 }
262 278
263 float LayoutSVGShape::strokeWidth() const 279 float LayoutSVGShape::strokeWidth() const
264 { 280 {
265 SVGLengthContext lengthContext(element()); 281 SVGLengthContext lengthContext(element());
266 return lengthContext.valueForLength(style()->svgStyle().strokeWidth()); 282 return lengthContext.valueForLength(style()->svgStyle().strokeWidth());
267 } 283 }
268 284
269 } 285 }
OLDNEW
« Source/core/layout/svg/LayoutSVGPath.cpp ('K') | « Source/core/layout/svg/LayoutSVGShape.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698