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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 SVGSubpathData subpathData(m_zeroLengthLinecapLocations); | 115 SVGSubpathData subpathData(m_zeroLengthLinecapLocations); |
116 path().apply(&subpathData, SVGSubpathData::updateFromPathElement); | 116 path().apply(&subpathData, SVGSubpathData::updateFromPathElement); |
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::cachedResourcesForRenderObject(
this); | 124 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObject(
this); |
125 ASSERT(resources); | 125 ASSERT(resources); |
126 | 126 |
127 RenderSVGResourceMarker* markerStart = resources->markerStart(); | 127 RenderSVGResourceMarker* markerStart = resources->markerStart(); |
128 RenderSVGResourceMarker* markerMid = resources->markerMid(); | 128 RenderSVGResourceMarker* markerMid = resources->markerMid(); |
129 RenderSVGResourceMarker* markerEnd = resources->markerEnd(); | 129 RenderSVGResourceMarker* 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 (RenderSVGResourceMarker* 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 |
146 if (!SVGResources::supportsMarkers(*toSVGGraphicsElement(element()))) | 146 if (!SVGResources::supportsMarkers(*toSVGGraphicsElement(element()))) |
147 return false; | 147 return false; |
148 | 148 |
149 SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(
this); | 149 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObject(
this); |
150 if (!resources) | 150 if (!resources) |
151 return false; | 151 return false; |
152 | 152 |
153 return resources->markerStart() || resources->markerMid() || resources->mark
erEnd(); | 153 return resources->markerStart() || resources->markerMid() || resources->mark
erEnd(); |
154 } | 154 } |
155 | 155 |
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::cachedResourcesForRenderObject(
this); | 163 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObject(
this); |
164 ASSERT(resources); | 164 ASSERT(resources); |
165 | 165 |
166 RenderSVGResourceMarker* markerStart = resources->markerStart(); | 166 RenderSVGResourceMarker* 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 |