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

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

Issue 980233002: [svg2] Make 'cx', 'cy' and 'r' presentation attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 years, 9 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
« no previous file with comments | « Source/core/layout/svg/LayoutSVGEllipse.cpp ('k') | Source/core/svg/SVGCircleElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/svg/SVGPathData.cpp
diff --git a/Source/core/layout/svg/SVGPathData.cpp b/Source/core/layout/svg/SVGPathData.cpp
index 3e2e85b1ae1198fa887198508377a31fa91c454a..1830da82ab27a113b2607d963c807e83b21c9bf2 100644
--- a/Source/core/layout/svg/SVGPathData.cpp
+++ b/Source/core/layout/svg/SVGPathData.cpp
@@ -40,21 +40,25 @@ using namespace SVGNames;
static void updatePathFromCircleElement(SVGElement* element, Path& path)
{
- SVGCircleElement* circle = toSVGCircleElement(element);
+ ASSERT(element->layoutObject());
SVGLengthContext lengthContext(element);
- float r = circle->r()->currentValue()->value(lengthContext);
- if (r > 0)
- path.addEllipse(FloatRect(circle->cx()->currentValue()->value(lengthContext) - r, circle->cy()->currentValue()->value(lengthContext) - r, r * 2, r * 2));
+ const LayoutStyle& style = element->layoutObject()->styleRef();
+ float r = lengthContext.valueForLength(style.svgStyle().r(), style, SVGLengthMode::Other);
+ if (r > 0) {
+ path.addEllipse(FloatRect(
+ lengthContext.valueForLength(style.svgStyle().cx(), style, SVGLengthMode::Width) - r,
+ lengthContext.valueForLength(style.svgStyle().cy(), style, SVGLengthMode::Height) - r,
+ r * 2, r * 2));
+ }
}
static void updatePathFromEllipseElement(SVGElement* element, Path& path)
{
- SVGEllipseElement* ellipse = toSVGEllipseElement(element);
- ASSERT(ellipse->layoutObject());
+ ASSERT(element->layoutObject());
SVGLengthContext lengthContext(element);
- const LayoutStyle& style = ellipse->layoutObject()->styleRef();
+ const LayoutStyle& style = element->layoutObject()->styleRef();
float rx = lengthContext.valueForLength(style.svgStyle().rx(), style, SVGLengthMode::Width);
if (rx < 0)
return;
@@ -64,7 +68,10 @@ static void updatePathFromEllipseElement(SVGElement* element, Path& path)
if (!rx && !ry)
return;
- path.addEllipse(FloatRect(ellipse->cx()->currentValue()->value(lengthContext) - rx, ellipse->cy()->currentValue()->value(lengthContext) - ry, rx * 2, ry * 2));
+ path.addEllipse(FloatRect(
+ lengthContext.valueForLength(style.svgStyle().cx(), style, SVGLengthMode::Width) - rx,
+ lengthContext.valueForLength(style.svgStyle().cy(), style, SVGLengthMode::Height) - ry,
+ rx * 2, ry * 2));
}
static void updatePathFromLineElement(SVGElement* element, Path& path)
« no previous file with comments | « Source/core/layout/svg/LayoutSVGEllipse.cpp ('k') | Source/core/svg/SVGCircleElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698