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

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

Issue 22877029: Introduce toSVGEllipseElement(), and use it (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 4 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 29 matching lines...) Expand all
40 SVGCircleElement* circle = static_cast<SVGCircleElement*>(element); 40 SVGCircleElement* circle = static_cast<SVGCircleElement*>(element);
41 41
42 SVGLengthContext lengthContext(element); 42 SVGLengthContext lengthContext(element);
43 float r = circle->rCurrentValue().value(lengthContext); 43 float r = circle->rCurrentValue().value(lengthContext);
44 if (r > 0) 44 if (r > 0)
45 path.addEllipse(FloatRect(circle->cxCurrentValue().value(lengthContext) - r, circle->cyCurrentValue().value(lengthContext) - r, r * 2, r * 2)); 45 path.addEllipse(FloatRect(circle->cxCurrentValue().value(lengthContext) - r, circle->cyCurrentValue().value(lengthContext) - r, r * 2, r * 2));
46 } 46 }
47 47
48 static void updatePathFromEllipseElement(SVGElement* element, Path& path) 48 static void updatePathFromEllipseElement(SVGElement* element, Path& path)
49 { 49 {
50 ASSERT(element->hasTagName(SVGNames::ellipseTag)); 50 SVGEllipseElement* ellipse = toSVGEllipseElement(element);
51 SVGEllipseElement* ellipse = static_cast<SVGEllipseElement*>(element);
52 51
53 SVGLengthContext lengthContext(element); 52 SVGLengthContext lengthContext(element);
54 float rx = ellipse->rxCurrentValue().value(lengthContext); 53 float rx = ellipse->rxCurrentValue().value(lengthContext);
55 if (rx <= 0) 54 if (rx <= 0)
56 return; 55 return;
57 float ry = ellipse->ryCurrentValue().value(lengthContext); 56 float ry = ellipse->ryCurrentValue().value(lengthContext);
58 if (ry <= 0) 57 if (ry <= 0)
59 return; 58 return;
60 path.addEllipse(FloatRect(ellipse->cxCurrentValue().value(lengthContext) - r x, ellipse->cyCurrentValue().value(lengthContext) - ry, rx * 2, ry * 2)); 59 path.addEllipse(FloatRect(ellipse->cxCurrentValue().value(lengthContext) - r x, ellipse->cyCurrentValue().value(lengthContext) - ry, rx * 2, ry * 2));
61 } 60 }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 map->set(SVGNames::polygonTag.localName().impl(), updatePathFromPolygonE lement); 154 map->set(SVGNames::polygonTag.localName().impl(), updatePathFromPolygonE lement);
156 map->set(SVGNames::polylineTag.localName().impl(), updatePathFromPolylin eElement); 155 map->set(SVGNames::polylineTag.localName().impl(), updatePathFromPolylin eElement);
157 map->set(SVGNames::rectTag.localName().impl(), updatePathFromRectElement ); 156 map->set(SVGNames::rectTag.localName().impl(), updatePathFromRectElement );
158 } 157 }
159 158
160 if (PathUpdateFunction pathUpdateFunction = map->get(element->localName().im pl())) 159 if (PathUpdateFunction pathUpdateFunction = map->get(element->localName().im pl()))
161 (*pathUpdateFunction)(element, path); 160 (*pathUpdateFunction)(element, path);
162 } 161 }
163 162
164 } // namespace WebCore 163 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGEllipse.cpp ('k') | Source/core/rendering/svg/SVGRenderTreeAsText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698