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

Side by Side Diff: Source/core/rendering/svg/SVGPathData.cpp

Issue 23566016: Introduce toSVGPolygonElement(), and use it (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 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
« no previous file with comments | « no previous file | Source/core/svg/SVGPolygonElement.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 path.addLineTo(FloatPoint(line->x2CurrentValue().value(lengthContext), line- >y2CurrentValue().value(lengthContext))); 67 path.addLineTo(FloatPoint(line->x2CurrentValue().value(lengthContext), line- >y2CurrentValue().value(lengthContext)));
68 } 68 }
69 69
70 static void updatePathFromPathElement(SVGElement* element, Path& path) 70 static void updatePathFromPathElement(SVGElement* element, Path& path)
71 { 71 {
72 buildPathFromByteStream(toSVGPathElement(element)->pathByteStream(), path); 72 buildPathFromByteStream(toSVGPathElement(element)->pathByteStream(), path);
73 } 73 }
74 74
75 static void updatePathFromPolygonElement(SVGElement* element, Path& path) 75 static void updatePathFromPolygonElement(SVGElement* element, Path& path)
76 { 76 {
77 ASSERT(element->hasTagName(SVGNames::polygonTag)); 77 SVGPointList& points = toSVGPolygonElement(element)->pointList();
78 SVGPolygonElement* polygon = static_cast<SVGPolygonElement*>(element);
79
80 SVGPointList& points = polygon->pointList();
81 if (points.isEmpty()) 78 if (points.isEmpty())
82 return; 79 return;
83 80
84 path.moveTo(points.first()); 81 path.moveTo(points.first());
85 82
86 unsigned size = points.size(); 83 unsigned size = points.size();
87 for (unsigned i = 1; i < size; ++i) 84 for (unsigned i = 1; i < size; ++i)
88 path.addLineTo(points.at(i)); 85 path.addLineTo(points.at(i));
89 86
90 path.closeSubpath(); 87 path.closeSubpath();
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 map->set(SVGNames::polygonTag.localName().impl(), updatePathFromPolygonE lement); 149 map->set(SVGNames::polygonTag.localName().impl(), updatePathFromPolygonE lement);
153 map->set(SVGNames::polylineTag.localName().impl(), updatePathFromPolylin eElement); 150 map->set(SVGNames::polylineTag.localName().impl(), updatePathFromPolylin eElement);
154 map->set(SVGNames::rectTag.localName().impl(), updatePathFromRectElement ); 151 map->set(SVGNames::rectTag.localName().impl(), updatePathFromRectElement );
155 } 152 }
156 153
157 if (PathUpdateFunction pathUpdateFunction = map->get(element->localName().im pl())) 154 if (PathUpdateFunction pathUpdateFunction = map->get(element->localName().im pl()))
158 (*pathUpdateFunction)(element, path); 155 (*pathUpdateFunction)(element, path);
159 } 156 }
160 157
161 } // namespace WebCore 158 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/svg/SVGPolygonElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698