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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2007, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2007, 2009 Apple Inc. All rights reserved.
3 * (C) 2005 Rob Buis <buis@kde.org> 3 * (C) 2005 Rob Buis <buis@kde.org>
4 * (C) 2006 Alexander Kellett <lypanov@kde.org> 4 * (C) 2006 Alexander Kellett <lypanov@kde.org>
5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #include "core/paint/PaintLayer.h" 52 #include "core/paint/PaintLayer.h"
53 #include "core/svg/LinearGradientAttributes.h" 53 #include "core/svg/LinearGradientAttributes.h"
54 #include "core/svg/PatternAttributes.h" 54 #include "core/svg/PatternAttributes.h"
55 #include "core/svg/RadialGradientAttributes.h" 55 #include "core/svg/RadialGradientAttributes.h"
56 #include "core/svg/SVGCircleElement.h" 56 #include "core/svg/SVGCircleElement.h"
57 #include "core/svg/SVGEllipseElement.h" 57 #include "core/svg/SVGEllipseElement.h"
58 #include "core/svg/SVGFilterElement.h" 58 #include "core/svg/SVGFilterElement.h"
59 #include "core/svg/SVGLineElement.h" 59 #include "core/svg/SVGLineElement.h"
60 #include "core/svg/SVGLinearGradientElement.h" 60 #include "core/svg/SVGLinearGradientElement.h"
61 #include "core/svg/SVGPathElement.h" 61 #include "core/svg/SVGPathElement.h"
62 #include "core/svg/SVGPathUtilities.h"
62 #include "core/svg/SVGPatternElement.h" 63 #include "core/svg/SVGPatternElement.h"
63 #include "core/svg/SVGPointList.h" 64 #include "core/svg/SVGPointList.h"
64 #include "core/svg/SVGPolyElement.h" 65 #include "core/svg/SVGPolyElement.h"
65 #include "core/svg/SVGRadialGradientElement.h" 66 #include "core/svg/SVGRadialGradientElement.h"
66 #include "core/svg/SVGRectElement.h" 67 #include "core/svg/SVGRectElement.h"
67 #include "core/svg/SVGStopElement.h" 68 #include "core/svg/SVGStopElement.h"
68 #include "core/svg/graphics/filters/SVGFilterBuilder.h" 69 #include "core/svg/graphics/filters/SVGFilterBuilder.h"
69 #include "platform/graphics/DashArray.h" 70 #include "platform/graphics/DashArray.h"
70 #include "platform/graphics/GraphicsTypes.h" 71 #include "platform/graphics/GraphicsTypes.h"
71 #include "platform/graphics/filters/Filter.h" 72 #include "platform/graphics/filters/Filter.h"
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 WriteStyle(ts, object); 338 WriteStyle(ts, object);
338 return ts; 339 return ts;
339 } 340 }
340 341
341 static TextStream& operator<<(TextStream& ts, const LayoutSVGShape& shape) { 342 static TextStream& operator<<(TextStream& ts, const LayoutSVGShape& shape) {
342 WritePositionAndStyle(ts, shape); 343 WritePositionAndStyle(ts, shape);
343 344
344 SVGElement* svg_element = shape.GetElement(); 345 SVGElement* svg_element = shape.GetElement();
345 DCHECK(svg_element); 346 DCHECK(svg_element);
346 SVGLengthContext length_context(svg_element); 347 SVGLengthContext length_context(svg_element);
348 const ComputedStyle& style = shape.StyleRef();
349 const SVGComputedStyle& svg_style = style.SvgStyle();
347 350
348 if (isSVGRectElement(*svg_element)) { 351 if (isSVGRectElement(*svg_element)) {
349 SVGRectElement& element = toSVGRectElement(*svg_element);
350 WriteNameValuePair(ts, "x", 352 WriteNameValuePair(ts, "x",
351 element.x()->CurrentValue()->Value(length_context)); 353 length_context.ValueForLength(svg_style.X(), style,
354 SVGLengthMode::kWidth));
352 WriteNameValuePair(ts, "y", 355 WriteNameValuePair(ts, "y",
353 element.y()->CurrentValue()->Value(length_context)); 356 length_context.ValueForLength(svg_style.Y(), style,
357 SVGLengthMode::kHeight));
354 WriteNameValuePair(ts, "width", 358 WriteNameValuePair(ts, "width",
355 element.width()->CurrentValue()->Value(length_context)); 359 length_context.ValueForLength(style.Width(), style,
360 SVGLengthMode::kWidth));
356 WriteNameValuePair(ts, "height", 361 WriteNameValuePair(ts, "height",
357 element.height()->CurrentValue()->Value(length_context)); 362 length_context.ValueForLength(style.Height(), style,
363 SVGLengthMode::kHeight));
358 } else if (isSVGLineElement(*svg_element)) { 364 } else if (isSVGLineElement(*svg_element)) {
359 SVGLineElement& element = toSVGLineElement(*svg_element); 365 SVGLineElement& element = toSVGLineElement(*svg_element);
360 WriteNameValuePair(ts, "x1", 366 WriteNameValuePair(ts, "x1",
361 element.x1()->CurrentValue()->Value(length_context)); 367 element.x1()->CurrentValue()->Value(length_context));
362 WriteNameValuePair(ts, "y1", 368 WriteNameValuePair(ts, "y1",
363 element.y1()->CurrentValue()->Value(length_context)); 369 element.y1()->CurrentValue()->Value(length_context));
364 WriteNameValuePair(ts, "x2", 370 WriteNameValuePair(ts, "x2",
365 element.x2()->CurrentValue()->Value(length_context)); 371 element.x2()->CurrentValue()->Value(length_context));
366 WriteNameValuePair(ts, "y2", 372 WriteNameValuePair(ts, "y2",
367 element.y2()->CurrentValue()->Value(length_context)); 373 element.y2()->CurrentValue()->Value(length_context));
368 } else if (isSVGEllipseElement(*svg_element)) { 374 } else if (isSVGEllipseElement(*svg_element)) {
369 SVGEllipseElement& element = toSVGEllipseElement(*svg_element);
370 WriteNameValuePair(ts, "cx", 375 WriteNameValuePair(ts, "cx",
371 element.cx()->CurrentValue()->Value(length_context)); 376 length_context.ValueForLength(svg_style.Cx(), style,
377 SVGLengthMode::kWidth));
372 WriteNameValuePair(ts, "cy", 378 WriteNameValuePair(ts, "cy",
373 element.cy()->CurrentValue()->Value(length_context)); 379 length_context.ValueForLength(svg_style.Cy(), style,
380 SVGLengthMode::kHeight));
374 WriteNameValuePair(ts, "rx", 381 WriteNameValuePair(ts, "rx",
375 element.rx()->CurrentValue()->Value(length_context)); 382 length_context.ValueForLength(svg_style.Rx(), style,
383 SVGLengthMode::kWidth));
376 WriteNameValuePair(ts, "ry", 384 WriteNameValuePair(ts, "ry",
377 element.ry()->CurrentValue()->Value(length_context)); 385 length_context.ValueForLength(svg_style.Ry(), style,
386 SVGLengthMode::kHeight));
378 } else if (isSVGCircleElement(*svg_element)) { 387 } else if (isSVGCircleElement(*svg_element)) {
379 SVGCircleElement& element = toSVGCircleElement(*svg_element);
380 WriteNameValuePair(ts, "cx", 388 WriteNameValuePair(ts, "cx",
381 element.cx()->CurrentValue()->Value(length_context)); 389 length_context.ValueForLength(svg_style.Cx(), style,
390 SVGLengthMode::kWidth));
382 WriteNameValuePair(ts, "cy", 391 WriteNameValuePair(ts, "cy",
383 element.cy()->CurrentValue()->Value(length_context)); 392 length_context.ValueForLength(svg_style.Cy(), style,
393 SVGLengthMode::kHeight));
384 WriteNameValuePair(ts, "r", 394 WriteNameValuePair(ts, "r",
385 element.r()->CurrentValue()->Value(length_context)); 395 length_context.ValueForLength(svg_style.R(), style,
396 SVGLengthMode::kOther));
386 } else if (IsSVGPolyElement(*svg_element)) { 397 } else if (IsSVGPolyElement(*svg_element)) {
387 WriteNameAndQuotedValue(ts, "points", 398 WriteNameAndQuotedValue(ts, "points",
388 ToSVGPolyElement(*svg_element) 399 ToSVGPolyElement(*svg_element)
389 .Points() 400 .Points()
390 ->CurrentValue() 401 ->CurrentValue()
391 ->ValueAsString()); 402 ->ValueAsString());
392 } else if (isSVGPathElement(*svg_element)) { 403 } else if (isSVGPathElement(*svg_element)) {
404 const StylePath& path =
405 svg_style.D() ? *svg_style.D() : *StylePath::EmptyPath();
393 WriteNameAndQuotedValue(ts, "data", 406 WriteNameAndQuotedValue(ts, "data",
394 toSVGPathElement(*svg_element) 407 BuildStringFromByteStream(path.ByteStream()));
395 .GetPath()
396 ->CurrentValue()
397 ->ValueAsString());
398 } else { 408 } else {
399 NOTREACHED(); 409 NOTREACHED();
400 } 410 }
401 return ts; 411 return ts;
402 } 412 }
403 413
404 static TextStream& operator<<(TextStream& ts, const LayoutSVGRoot& root) { 414 static TextStream& operator<<(TextStream& ts, const LayoutSVGRoot& root) {
405 ts << " " << root.FrameRect(); 415 ts << " " << root.FrameRect();
406 WriteStyle(ts, root); 416 WriteStyle(ts, root);
407 return ts; 417 return ts;
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 WriteIndent(ts, indent); 767 WriteIndent(ts, indent);
758 ts << " "; 768 ts << " ";
759 WriteNameAndQuotedValue(ts, "filter", id); 769 WriteNameAndQuotedValue(ts, "filter", id);
760 ts << " "; 770 ts << " ";
761 WriteStandardPrefix(ts, *filter, 0); 771 WriteStandardPrefix(ts, *filter, 0);
762 ts << " " << filter->ResourceBoundingBox(&object) << "\n"; 772 ts << " " << filter->ResourceBoundingBox(&object) << "\n";
763 } 773 }
764 } 774 }
765 775
766 } // namespace blink 776 } // namespace blink
OLDNEW
« 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