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

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

Issue 19914002: Use toSVGPathElement() instead of static_cast<> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 5 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
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 ASSERT(element->hasTagName(SVGNames::lineTag)); 65 ASSERT(element->hasTagName(SVGNames::lineTag));
66 SVGLineElement* line = static_cast<SVGLineElement*>(element); 66 SVGLineElement* line = static_cast<SVGLineElement*>(element);
67 67
68 SVGLengthContext lengthContext(element); 68 SVGLengthContext lengthContext(element);
69 path.moveTo(FloatPoint(line->x1CurrentValue().value(lengthContext), line->y1 CurrentValue().value(lengthContext))); 69 path.moveTo(FloatPoint(line->x1CurrentValue().value(lengthContext), line->y1 CurrentValue().value(lengthContext)));
70 path.addLineTo(FloatPoint(line->x2CurrentValue().value(lengthContext), line- >y2CurrentValue().value(lengthContext))); 70 path.addLineTo(FloatPoint(line->x2CurrentValue().value(lengthContext), line- >y2CurrentValue().value(lengthContext)));
71 } 71 }
72 72
73 static void updatePathFromPathElement(SVGElement* element, Path& path) 73 static void updatePathFromPathElement(SVGElement* element, Path& path)
74 { 74 {
75 ASSERT(element->hasTagName(SVGNames::pathTag)); 75 ASSERT(element->hasTagName(SVGNames::pathTag));
tkent 2013/07/21 20:50:30 This ASSERT is redundant. Please remove it.
76 buildPathFromByteStream(static_cast<SVGPathElement*>(element)->pathByteStrea m(), path); 76 buildPathFromByteStream(toSVGPathElement(element)->pathByteStream(), path);
77 } 77 }
78 78
79 static void updatePathFromPolygonElement(SVGElement* element, Path& path) 79 static void updatePathFromPolygonElement(SVGElement* element, Path& path)
80 { 80 {
81 ASSERT(element->hasTagName(SVGNames::polygonTag)); 81 ASSERT(element->hasTagName(SVGNames::polygonTag));
82 SVGPolygonElement* polygon = static_cast<SVGPolygonElement*>(element); 82 SVGPolygonElement* polygon = static_cast<SVGPolygonElement*>(element);
83 83
84 SVGPointList& points = polygon->pointList(); 84 SVGPointList& points = polygon->pointList();
85 if (points.isEmpty()) 85 if (points.isEmpty())
86 return; 86 return;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 map->set(SVGNames::polygonTag.localName().impl(), updatePathFromPolygonE lement); 157 map->set(SVGNames::polygonTag.localName().impl(), updatePathFromPolygonE lement);
158 map->set(SVGNames::polylineTag.localName().impl(), updatePathFromPolylin eElement); 158 map->set(SVGNames::polylineTag.localName().impl(), updatePathFromPolylin eElement);
159 map->set(SVGNames::rectTag.localName().impl(), updatePathFromRectElement ); 159 map->set(SVGNames::rectTag.localName().impl(), updatePathFromRectElement );
160 } 160 }
161 161
162 if (PathUpdateFunction pathUpdateFunction = map->get(element->localName().im pl())) 162 if (PathUpdateFunction pathUpdateFunction = map->get(element->localName().im pl()))
163 (*pathUpdateFunction)(element, path); 163 (*pathUpdateFunction)(element, path);
164 } 164 }
165 165
166 } // namespace WebCore 166 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698