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 11 matching lines...) Expand all Loading... |
22 * You should have received a copy of the GNU Library General Public License | 22 * You should have received a copy of the GNU Library General Public License |
23 * along with this library; see the file COPYING.LIB. If not, write to | 23 * along with this library; see the file COPYING.LIB. If not, write to |
24 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 24 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 * Boston, MA 02110-1301, USA. | 25 * Boston, MA 02110-1301, USA. |
26 */ | 26 */ |
27 | 27 |
28 #include "config.h" | 28 #include "config.h" |
29 | 29 |
30 #include "core/rendering/svg/RenderSVGPath.h" | 30 #include "core/rendering/svg/RenderSVGPath.h" |
31 | 31 |
| 32 #include "core/layout/svg/LayoutSVGResourceMarker.h" |
32 #include "core/layout/svg/SVGResources.h" | 33 #include "core/layout/svg/SVGResources.h" |
33 #include "core/layout/svg/SVGResourcesCache.h" | 34 #include "core/layout/svg/SVGResourcesCache.h" |
34 #include "core/layout/svg/SVGSubpathData.h" | 35 #include "core/layout/svg/SVGSubpathData.h" |
35 #include "core/rendering/svg/RenderSVGResourceMarker.h" | |
36 #include "core/svg/SVGGraphicsElement.h" | 36 #include "core/svg/SVGGraphicsElement.h" |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 RenderSVGPath::RenderSVGPath(SVGGraphicsElement* node) | 40 RenderSVGPath::RenderSVGPath(SVGGraphicsElement* node) |
41 : RenderSVGShape(node) | 41 : RenderSVGShape(node) |
42 { | 42 { |
43 } | 43 } |
44 | 44 |
45 RenderSVGPath::~RenderSVGPath() | 45 RenderSVGPath::~RenderSVGPath() |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 subpathData.pathIsDone(); | 117 subpathData.pathIsDone(); |
118 } | 118 } |
119 | 119 |
120 FloatRect RenderSVGPath::markerRect(float strokeWidth) const | 120 FloatRect RenderSVGPath::markerRect(float strokeWidth) const |
121 { | 121 { |
122 ASSERT(!m_markerPositions.isEmpty()); | 122 ASSERT(!m_markerPositions.isEmpty()); |
123 | 123 |
124 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObject(
this); | 124 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObject(
this); |
125 ASSERT(resources); | 125 ASSERT(resources); |
126 | 126 |
127 RenderSVGResourceMarker* markerStart = resources->markerStart(); | 127 LayoutSVGResourceMarker* markerStart = resources->markerStart(); |
128 RenderSVGResourceMarker* markerMid = resources->markerMid(); | 128 LayoutSVGResourceMarker* markerMid = resources->markerMid(); |
129 RenderSVGResourceMarker* markerEnd = resources->markerEnd(); | 129 LayoutSVGResourceMarker* markerEnd = resources->markerEnd(); |
130 ASSERT(markerStart || markerMid || markerEnd); | 130 ASSERT(markerStart || markerMid || markerEnd); |
131 | 131 |
132 FloatRect boundaries; | 132 FloatRect boundaries; |
133 unsigned size = m_markerPositions.size(); | 133 unsigned size = m_markerPositions.size(); |
134 for (unsigned i = 0; i < size; ++i) { | 134 for (unsigned i = 0; i < size; ++i) { |
135 if (RenderSVGResourceMarker* marker = SVGMarkerData::markerForType(m_mar
kerPositions[i].type, markerStart, markerMid, markerEnd)) | 135 if (LayoutSVGResourceMarker* marker = SVGMarkerData::markerForType(m_mar
kerPositions[i].type, markerStart, markerMid, markerEnd)) |
136 boundaries.unite(marker->markerBoundaries(marker->markerTransformati
on(m_markerPositions[i].origin, m_markerPositions[i].angle, strokeWidth))); | 136 boundaries.unite(marker->markerBoundaries(marker->markerTransformati
on(m_markerPositions[i].origin, m_markerPositions[i].angle, strokeWidth))); |
137 } | 137 } |
138 return boundaries; | 138 return boundaries; |
139 } | 139 } |
140 | 140 |
141 bool RenderSVGPath::shouldGenerateMarkerPositions() const | 141 bool RenderSVGPath::shouldGenerateMarkerPositions() const |
142 { | 142 { |
143 if (!style()->svgStyle().hasMarkers()) | 143 if (!style()->svgStyle().hasMarkers()) |
144 return false; | 144 return false; |
145 | 145 |
(...skipping 10 matching lines...) Expand all Loading... |
156 void RenderSVGPath::processMarkerPositions() | 156 void RenderSVGPath::processMarkerPositions() |
157 { | 157 { |
158 m_markerPositions.clear(); | 158 m_markerPositions.clear(); |
159 | 159 |
160 if (!shouldGenerateMarkerPositions()) | 160 if (!shouldGenerateMarkerPositions()) |
161 return; | 161 return; |
162 | 162 |
163 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObject(
this); | 163 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObject(
this); |
164 ASSERT(resources); | 164 ASSERT(resources); |
165 | 165 |
166 RenderSVGResourceMarker* markerStart = resources->markerStart(); | 166 LayoutSVGResourceMarker* markerStart = resources->markerStart(); |
167 | 167 |
168 SVGMarkerData markerData(m_markerPositions, markerStart ? markerStart->orien
tType() == SVGMarkerOrientAutoStartReverse : false); | 168 SVGMarkerData markerData(m_markerPositions, markerStart ? markerStart->orien
tType() == SVGMarkerOrientAutoStartReverse : false); |
169 path().apply(&markerData, SVGMarkerData::updateFromPathElement); | 169 path().apply(&markerData, SVGMarkerData::updateFromPathElement); |
170 markerData.pathIsDone(); | 170 markerData.pathIsDone(); |
171 } | 171 } |
172 | 172 |
173 } | 173 } |
OLD | NEW |