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

Unified Diff: Source/core/rendering/svg/SVGPathData.cpp

Issue 132233016: [SVG] SVGAnimatedPointList migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/svg/SVGPathData.cpp
diff --git a/Source/core/rendering/svg/SVGPathData.cpp b/Source/core/rendering/svg/SVGPathData.cpp
index 32a2a587b97755be5f3969edc0378be114cbb6ef..3ae72594683e981d0b3659bccb5c65d6b5f00728 100644
--- a/Source/core/rendering/svg/SVGPathData.cpp
+++ b/Source/core/rendering/svg/SVGPathData.cpp
@@ -72,32 +72,26 @@ static void updatePathFromPathElement(SVGElement* element, Path& path)
buildPathFromByteStream(toSVGPathElement(element)->pathByteStream(), path);
}
-static void updatePathFromPolygonElement(SVGElement* element, Path& path)
+static void updatePathFromPolylineElement(SVGElement* element, Path& path)
{
- SVGPointList& points = toSVGPolygonElement(element)->pointsCurrentValue();
- if (points.isEmpty())
+ RefPtr<SVGPointList> points = toSVGPolyElement(element)->points()->currentValue();
+ if (points->isEmpty())
return;
- path.moveTo(points.first());
-
- unsigned size = points.size();
- for (unsigned i = 1; i < size; ++i)
- path.addLineTo(points.at(i));
+ SVGPointList::ConstIterator it = points->begin();
+ SVGPointList::ConstIterator itEnd = points->end();
+ ASSERT(it != itEnd);
+ path.moveTo(it->value());
+ ++it;
- path.closeSubpath();
+ for (; it != itEnd; ++it)
+ path.addLineTo(it->value());
haraken 2014/01/17 11:50:18 In the previous code, we didn't call addLineTo for
kouhei (in TOK) 2014/01/20 01:10:26 We are not calling addLineTo for the first element
}
-static void updatePathFromPolylineElement(SVGElement* element, Path& path)
+static void updatePathFromPolygonElement(SVGElement* element, Path& path)
{
- SVGPointList& points = toSVGPolylineElement(element)->pointsCurrentValue();
- if (points.isEmpty())
- return;
-
- path.moveTo(points.first());
-
- unsigned size = points.size();
- for (unsigned i = 1; i < size; ++i)
- path.addLineTo(points.at(i));
+ updatePathFromPolylineElement(element, path);
haraken 2014/01/17 11:50:18 What's the advantage of introducing this static me
kouhei (in TOK) 2014/01/20 01:10:26 This is for <polygon> element. The above is for <p
+ path.closeSubpath();
}
static void updatePathFromRectElement(SVGElement* element, Path& path)

Powered by Google App Engine
This is Rietveld 408576698