OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 unsigned size = points.size(); | 83 unsigned size = points.size(); |
84 for (unsigned i = 1; i < size; ++i) | 84 for (unsigned i = 1; i < size; ++i) |
85 path.addLineTo(points.at(i)); | 85 path.addLineTo(points.at(i)); |
86 | 86 |
87 path.closeSubpath(); | 87 path.closeSubpath(); |
88 } | 88 } |
89 | 89 |
90 static void updatePathFromPolylineElement(SVGElement* element, Path& path) | 90 static void updatePathFromPolylineElement(SVGElement* element, Path& path) |
91 { | 91 { |
92 ASSERT(element->hasTagName(SVGNames::polylineTag)); | 92 SVGPointList& points = toSVGPolylineElement(element)->pointList(); |
93 SVGPolylineElement* polyline = static_cast<SVGPolylineElement*>(element); | |
94 | |
95 SVGPointList& points = polyline->pointList(); | |
96 if (points.isEmpty()) | 93 if (points.isEmpty()) |
97 return; | 94 return; |
98 | 95 |
99 path.moveTo(points.first()); | 96 path.moveTo(points.first()); |
100 | 97 |
101 unsigned size = points.size(); | 98 unsigned size = points.size(); |
102 for (unsigned i = 1; i < size; ++i) | 99 for (unsigned i = 1; i < size; ++i) |
103 path.addLineTo(points.at(i)); | 100 path.addLineTo(points.at(i)); |
104 } | 101 } |
105 | 102 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 map->set(SVGNames::polygonTag.localName().impl(), updatePathFromPolygonE
lement); | 146 map->set(SVGNames::polygonTag.localName().impl(), updatePathFromPolygonE
lement); |
150 map->set(SVGNames::polylineTag.localName().impl(), updatePathFromPolylin
eElement); | 147 map->set(SVGNames::polylineTag.localName().impl(), updatePathFromPolylin
eElement); |
151 map->set(SVGNames::rectTag.localName().impl(), updatePathFromRectElement
); | 148 map->set(SVGNames::rectTag.localName().impl(), updatePathFromRectElement
); |
152 } | 149 } |
153 | 150 |
154 if (PathUpdateFunction pathUpdateFunction = map->get(element->localName().im
pl())) | 151 if (PathUpdateFunction pathUpdateFunction = map->get(element->localName().im
pl())) |
155 (*pathUpdateFunction)(element, path); | 152 (*pathUpdateFunction)(element, path); |
156 } | 153 } |
157 | 154 |
158 } // namespace WebCore | 155 } // namespace WebCore |
OLD | NEW |