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

Unified Diff: Source/core/layout/svg/LayoutSVGEllipse.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/style/SVGLayoutStyleDefs.cpp ('k') | Source/core/layout/svg/SVGPathData.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/svg/LayoutSVGEllipse.cpp
diff --git a/Source/core/layout/svg/LayoutSVGEllipse.cpp b/Source/core/layout/svg/LayoutSVGEllipse.cpp
index b7ecc369fdcf3b46f41217f4ebcdd35fc220de0c..3e07df274112ef785e733ed8a7295dcea36db922 100644
--- a/Source/core/layout/svg/LayoutSVGEllipse.cpp
+++ b/Source/core/layout/svg/LayoutSVGEllipse.cpp
@@ -82,21 +82,19 @@ void LayoutSVGEllipse::updateShapeFromElement()
void LayoutSVGEllipse::calculateRadiiAndCenter()
{
ASSERT(element());
- if (isSVGCircleElement(*element())) {
- SVGCircleElement& circle = toSVGCircleElement(*element());
+ SVGLengthContext lengthContext(element());
+ m_center = FloatPoint(
+ lengthContext.valueForLength(style()->svgStyle().cx(), styleRef(), SVGLengthMode::Width),
+ lengthContext.valueForLength(style()->svgStyle().cy(), styleRef(), SVGLengthMode::Height));
- SVGLengthContext lengthContext(&circle);
- float radius = circle.r()->currentValue()->value(lengthContext);
+ if (isSVGCircleElement(*element())) {
+ float radius = lengthContext.valueForLength(style()->svgStyle().r(), styleRef(), SVGLengthMode::Other);
m_radii = FloatSize(radius, radius);
- m_center = FloatPoint(circle.cx()->currentValue()->value(lengthContext), circle.cy()->currentValue()->value(lengthContext));
- return;
+ } else {
+ m_radii = FloatSize(
+ lengthContext.valueForLength(style()->svgStyle().rx(), styleRef(), SVGLengthMode::Width),
+ lengthContext.valueForLength(style()->svgStyle().ry(), styleRef(), SVGLengthMode::Height));
}
-
- SVGEllipseElement& ellipse = toSVGEllipseElement(*element());
-
- SVGLengthContext lengthContext(&ellipse);
- m_radii = FloatSize(ellipse.rx()->currentValue()->value(lengthContext), ellipse.ry()->currentValue()->value(lengthContext));
- m_center = FloatPoint(ellipse.cx()->currentValue()->value(lengthContext), ellipse.cy()->currentValue()->value(lengthContext));
}
bool LayoutSVGEllipse::shapeDependentStrokeContains(const FloatPoint& point)
« no previous file with comments | « Source/core/layout/style/SVGLayoutStyleDefs.cpp ('k') | Source/core/layout/svg/SVGPathData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698