OLD | NEW |
---|---|
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 { | 43 { |
44 } | 44 } |
45 | 45 |
46 LayoutSVGPath::~LayoutSVGPath() | 46 LayoutSVGPath::~LayoutSVGPath() |
47 { | 47 { |
48 } | 48 } |
49 | 49 |
50 void LayoutSVGPath::updateShapeFromElement() | 50 void LayoutSVGPath::updateShapeFromElement() |
51 { | 51 { |
52 LayoutSVGShape::updateShapeFromElement(); | 52 LayoutSVGShape::updateShapeFromElement(); |
53 updateZeroLengthSubpaths(); | |
54 } | |
55 | |
56 void LayoutSVGPath::updateStrokeAndFillBoundingBoxes() | |
57 { | |
58 LayoutSVGShape::updateStrokeAndFillBoundingBoxes(); | |
59 | |
60 // TODO(pdr): It would be ideal to only call this in updateShapeFromElement | |
fs
2015/06/16 10:54:02
I think the first part (line) of this makes sense.
pdr.
2015/06/17 03:50:49
Done
| |
61 // and have marker invalidation call setNeedsShapeUpdate. | |
53 processMarkerPositions(); | 62 processMarkerPositions(); |
54 updateZeroLengthSubpaths(); | 63 if (!m_markerPositions.isEmpty()) |
64 m_strokeBoundingBox.unite(markerRect(strokeWidth())); | |
55 | 65 |
56 m_strokeBoundingBox = calculateUpdatedStrokeBoundingBox(); | 66 if (style()->svgStyle().hasStroke()) { |
67 // FIXME: zero-length subpaths do not respect vector-effect = non-scalin g-stroke. | |
68 float strokeWidth = this->strokeWidth(); | |
69 for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) | |
70 m_strokeBoundingBox.unite(zeroLengthSubpathRect(m_zeroLengthLinecapL ocations[i], strokeWidth)); | |
71 } | |
57 } | 72 } |
58 | 73 |
59 FloatRect LayoutSVGPath::hitTestStrokeBoundingBox() const | 74 FloatRect LayoutSVGPath::hitTestStrokeBoundingBox() const |
60 { | 75 { |
61 const SVGComputedStyle& svgStyle = style()->svgStyle(); | 76 const SVGComputedStyle& svgStyle = style()->svgStyle(); |
62 if (svgStyle.hasStroke()) | 77 if (svgStyle.hasStroke()) |
63 return m_strokeBoundingBox; | 78 return m_strokeBoundingBox; |
64 | 79 |
65 // Implementation of http://dev.w3.org/fxtf/css-masking-1/#compute-stroke-bo unding-box | 80 // Implementation of http://dev.w3.org/fxtf/css-masking-1/#compute-stroke-bo unding-box |
66 // except that we ignore whether the stroke is none. | 81 // except that we ignore whether the stroke is none. |
(...skipping 17 matching lines...) Expand all Loading... | |
84 } | 99 } |
85 | 100 |
86 box.inflate(delta); | 101 box.inflate(delta); |
87 | 102 |
88 for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) | 103 for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) |
89 box.unite(zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeW idth)); | 104 box.unite(zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeW idth)); |
90 | 105 |
91 return box; | 106 return box; |
92 } | 107 } |
93 | 108 |
94 FloatRect LayoutSVGPath::calculateUpdatedStrokeBoundingBox() const | |
95 { | |
96 FloatRect strokeBoundingBox = m_strokeBoundingBox; | |
97 | |
98 if (!m_markerPositions.isEmpty()) | |
99 strokeBoundingBox.unite(markerRect(strokeWidth())); | |
100 | |
101 if (style()->svgStyle().hasStroke()) { | |
102 // FIXME: zero-length subpaths do not respect vector-effect = non-scalin g-stroke. | |
103 float strokeWidth = this->strokeWidth(); | |
104 for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) | |
105 strokeBoundingBox.unite(zeroLengthSubpathRect(m_zeroLengthLinecapLoc ations[i], strokeWidth)); | |
106 } | |
107 | |
108 return strokeBoundingBox; | |
109 } | |
110 | |
111 bool LayoutSVGPath::shapeDependentStrokeContains(const FloatPoint& point) | 109 bool LayoutSVGPath::shapeDependentStrokeContains(const FloatPoint& point) |
112 { | 110 { |
113 if (LayoutSVGShape::shapeDependentStrokeContains(point)) | 111 if (LayoutSVGShape::shapeDependentStrokeContains(point)) |
114 return true; | 112 return true; |
115 | 113 |
116 const SVGComputedStyle& svgStyle = style()->svgStyle(); | 114 const SVGComputedStyle& svgStyle = style()->svgStyle(); |
117 const float strokeWidth = this->strokeWidth(); | 115 const float strokeWidth = this->strokeWidth(); |
118 for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) { | 116 for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) { |
119 ASSERT(svgStyle.hasStroke()); | 117 ASSERT(svgStyle.hasStroke()); |
120 if (svgStyle.capStyle() == SquareCap) { | 118 if (svgStyle.capStyle() == SquareCap) { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
201 ASSERT(resources); | 199 ASSERT(resources); |
202 | 200 |
203 LayoutSVGResourceMarker* markerStart = resources->markerStart(); | 201 LayoutSVGResourceMarker* markerStart = resources->markerStart(); |
204 | 202 |
205 SVGMarkerData markerData(m_markerPositions, markerStart ? markerStart->orien tType() == SVGMarkerOrientAutoStartReverse : false); | 203 SVGMarkerData markerData(m_markerPositions, markerStart ? markerStart->orien tType() == SVGMarkerOrientAutoStartReverse : false); |
206 path().apply(&markerData, SVGMarkerData::updateFromPathElement); | 204 path().apply(&markerData, SVGMarkerData::updateFromPathElement); |
207 markerData.pathIsDone(); | 205 markerData.pathIsDone(); |
208 } | 206 } |
209 | 207 |
210 } | 208 } |
OLD | NEW |