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

Unified Diff: third_party/WebKit/Source/core/layout/svg/SVGLayoutTreeAsText.cpp

Issue 2888603005: Get SVGLayoutTreeAsText shape values from ComputedStyle (Closed)
Patch Set: Fix baselines Created 3 years, 7 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 | « third_party/WebKit/LayoutTests/platform/win7/svg/text/bbox-with-glyph-overflow-zoomed-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/svg/SVGLayoutTreeAsText.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGLayoutTreeAsText.cpp b/third_party/WebKit/Source/core/layout/svg/SVGLayoutTreeAsText.cpp
index b497c12b8a26e1c52061f1e2321ed9d1d8553fd4..2c75b1cef7e232d54976e0c9489c2b207d7edd64 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGLayoutTreeAsText.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/SVGLayoutTreeAsText.cpp
@@ -59,6 +59,7 @@
#include "core/svg/SVGLineElement.h"
#include "core/svg/SVGLinearGradientElement.h"
#include "core/svg/SVGPathElement.h"
+#include "core/svg/SVGPathUtilities.h"
#include "core/svg/SVGPatternElement.h"
#include "core/svg/SVGPointList.h"
#include "core/svg/SVGPolyElement.h"
@@ -344,17 +345,22 @@ static TextStream& operator<<(TextStream& ts, const LayoutSVGShape& shape) {
SVGElement* svg_element = shape.GetElement();
DCHECK(svg_element);
SVGLengthContext length_context(svg_element);
+ const ComputedStyle& style = shape.StyleRef();
+ const SVGComputedStyle& svg_style = style.SvgStyle();
if (isSVGRectElement(*svg_element)) {
- SVGRectElement& element = toSVGRectElement(*svg_element);
WriteNameValuePair(ts, "x",
- element.x()->CurrentValue()->Value(length_context));
+ length_context.ValueForLength(svg_style.X(), style,
+ SVGLengthMode::kWidth));
WriteNameValuePair(ts, "y",
- element.y()->CurrentValue()->Value(length_context));
+ length_context.ValueForLength(svg_style.Y(), style,
+ SVGLengthMode::kHeight));
WriteNameValuePair(ts, "width",
- element.width()->CurrentValue()->Value(length_context));
+ length_context.ValueForLength(style.Width(), style,
+ SVGLengthMode::kWidth));
WriteNameValuePair(ts, "height",
- element.height()->CurrentValue()->Value(length_context));
+ length_context.ValueForLength(style.Height(), style,
+ SVGLengthMode::kHeight));
} else if (isSVGLineElement(*svg_element)) {
SVGLineElement& element = toSVGLineElement(*svg_element);
WriteNameValuePair(ts, "x1",
@@ -366,23 +372,28 @@ static TextStream& operator<<(TextStream& ts, const LayoutSVGShape& shape) {
WriteNameValuePair(ts, "y2",
element.y2()->CurrentValue()->Value(length_context));
} else if (isSVGEllipseElement(*svg_element)) {
- SVGEllipseElement& element = toSVGEllipseElement(*svg_element);
WriteNameValuePair(ts, "cx",
- element.cx()->CurrentValue()->Value(length_context));
+ length_context.ValueForLength(svg_style.Cx(), style,
+ SVGLengthMode::kWidth));
WriteNameValuePair(ts, "cy",
- element.cy()->CurrentValue()->Value(length_context));
+ length_context.ValueForLength(svg_style.Cy(), style,
+ SVGLengthMode::kHeight));
WriteNameValuePair(ts, "rx",
- element.rx()->CurrentValue()->Value(length_context));
+ length_context.ValueForLength(svg_style.Rx(), style,
+ SVGLengthMode::kWidth));
WriteNameValuePair(ts, "ry",
- element.ry()->CurrentValue()->Value(length_context));
+ length_context.ValueForLength(svg_style.Ry(), style,
+ SVGLengthMode::kHeight));
} else if (isSVGCircleElement(*svg_element)) {
- SVGCircleElement& element = toSVGCircleElement(*svg_element);
WriteNameValuePair(ts, "cx",
- element.cx()->CurrentValue()->Value(length_context));
+ length_context.ValueForLength(svg_style.Cx(), style,
+ SVGLengthMode::kWidth));
WriteNameValuePair(ts, "cy",
- element.cy()->CurrentValue()->Value(length_context));
+ length_context.ValueForLength(svg_style.Cy(), style,
+ SVGLengthMode::kHeight));
WriteNameValuePair(ts, "r",
- element.r()->CurrentValue()->Value(length_context));
+ length_context.ValueForLength(svg_style.R(), style,
+ SVGLengthMode::kOther));
} else if (IsSVGPolyElement(*svg_element)) {
WriteNameAndQuotedValue(ts, "points",
ToSVGPolyElement(*svg_element)
@@ -390,11 +401,10 @@ static TextStream& operator<<(TextStream& ts, const LayoutSVGShape& shape) {
->CurrentValue()
->ValueAsString());
} else if (isSVGPathElement(*svg_element)) {
+ const StylePath& path =
+ svg_style.D() ? *svg_style.D() : *StylePath::EmptyPath();
WriteNameAndQuotedValue(ts, "data",
- toSVGPathElement(*svg_element)
- .GetPath()
- ->CurrentValue()
- ->ValueAsString());
+ BuildStringFromByteStream(path.ByteStream()));
} else {
NOTREACHED();
}
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/win7/svg/text/bbox-with-glyph-overflow-zoomed-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698