OLD | NEW |
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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 writeIfNotDefault(ts, "clip rule", svgStyle.clipRule(), RULE_NONZERO); | 320 writeIfNotDefault(ts, "clip rule", svgStyle.clipRule(), RULE_NONZERO); |
321 } | 321 } |
322 | 322 |
323 writeIfNotEmpty(ts, "start marker", svgStyle.markerStartResource()); | 323 writeIfNotEmpty(ts, "start marker", svgStyle.markerStartResource()); |
324 writeIfNotEmpty(ts, "middle marker", svgStyle.markerMidResource()); | 324 writeIfNotEmpty(ts, "middle marker", svgStyle.markerMidResource()); |
325 writeIfNotEmpty(ts, "end marker", svgStyle.markerEndResource()); | 325 writeIfNotEmpty(ts, "end marker", svgStyle.markerEndResource()); |
326 } | 326 } |
327 | 327 |
328 static TextStream& writePositionAndStyle(TextStream& ts, | 328 static TextStream& writePositionAndStyle(TextStream& ts, |
329 const LayoutObject& object) { | 329 const LayoutObject& object) { |
330 ts << " " << enclosingIntRect( | 330 ts << " " << object.objectBoundingBox(); |
331 const_cast<LayoutObject&>(object).absoluteVisualRect()); | |
332 writeStyle(ts, object); | 331 writeStyle(ts, object); |
333 return ts; | 332 return ts; |
334 } | 333 } |
335 | 334 |
336 static TextStream& operator<<(TextStream& ts, const LayoutSVGShape& shape) { | 335 static TextStream& operator<<(TextStream& ts, const LayoutSVGShape& shape) { |
337 writePositionAndStyle(ts, shape); | 336 writePositionAndStyle(ts, shape); |
338 | 337 |
339 SVGElement* svgElement = shape.element(); | 338 SVGElement* svgElement = shape.element(); |
340 ASSERT(svgElement); | 339 ASSERT(svgElement); |
341 SVGLengthContext lengthContext(svgElement); | 340 SVGLengthContext lengthContext(svgElement); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 writeNameAndQuotedValue( | 386 writeNameAndQuotedValue( |
388 ts, "data", | 387 ts, "data", |
389 toSVGPathElement(*svgElement).path()->currentValue()->valueAsString()); | 388 toSVGPathElement(*svgElement).path()->currentValue()->valueAsString()); |
390 } else { | 389 } else { |
391 ASSERT_NOT_REACHED(); | 390 ASSERT_NOT_REACHED(); |
392 } | 391 } |
393 return ts; | 392 return ts; |
394 } | 393 } |
395 | 394 |
396 static TextStream& operator<<(TextStream& ts, const LayoutSVGRoot& root) { | 395 static TextStream& operator<<(TextStream& ts, const LayoutSVGRoot& root) { |
397 return writePositionAndStyle(ts, root); | 396 ts << " " << root.frameRect(); |
| 397 writeStyle(ts, root); |
| 398 return ts; |
398 } | 399 } |
399 | 400 |
400 static void writeLayoutSVGTextBox(TextStream& ts, const LayoutSVGText& text) { | 401 static void writeLayoutSVGTextBox(TextStream& ts, const LayoutSVGText& text) { |
401 SVGRootInlineBox* box = toSVGRootInlineBox(text.firstRootBox()); | 402 SVGRootInlineBox* box = toSVGRootInlineBox(text.firstRootBox()); |
402 if (!box) | 403 if (!box) |
403 return; | 404 return; |
404 | 405 |
405 ts << " " << enclosingIntRect(LayoutRect( | |
406 LayoutPoint(text.location()), | |
407 LayoutSize(box->logicalWidth(), box->logicalHeight()))); | |
408 | |
409 // FIXME: Remove this hack, once the new text layout engine is completly | 406 // FIXME: Remove this hack, once the new text layout engine is completly |
410 // landed. We want to preserve the old layout test results for now. | 407 // landed. We want to preserve the old layout test results for now. |
411 ts << " contains 1 chunk(s)"; | 408 ts << " contains 1 chunk(s)"; |
412 | 409 |
413 if (text.parent() && (text.parent()->resolveColor(CSSPropertyColor) != | 410 if (text.parent() && (text.parent()->resolveColor(CSSPropertyColor) != |
414 text.resolveColor(CSSPropertyColor))) | 411 text.resolveColor(CSSPropertyColor))) { |
415 writeNameValuePair( | 412 writeNameValuePair( |
416 ts, "color", | 413 ts, "color", |
417 text.resolveColor(CSSPropertyColor).nameForLayoutTreeAsText()); | 414 text.resolveColor(CSSPropertyColor).nameForLayoutTreeAsText()); |
| 415 } |
418 } | 416 } |
419 | 417 |
420 static inline void writeSVGInlineTextBox(TextStream& ts, | 418 static inline void writeSVGInlineTextBox(TextStream& ts, |
421 SVGInlineTextBox* textBox, | 419 SVGInlineTextBox* textBox, |
422 int indent) { | 420 int indent) { |
423 Vector<SVGTextFragment>& fragments = textBox->textFragments(); | 421 Vector<SVGTextFragment>& fragments = textBox->textFragments(); |
424 if (fragments.isEmpty()) | 422 if (fragments.isEmpty()) |
425 return; | 423 return; |
426 | 424 |
427 LineLayoutSVGInlineText textLineLayout = | 425 LineLayoutSVGInlineText textLineLayout = |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 } | 646 } |
649 | 647 |
650 void write(TextStream& ts, const LayoutSVGRoot& root, int indent) { | 648 void write(TextStream& ts, const LayoutSVGRoot& root, int indent) { |
651 writeStandardPrefix(ts, root, indent); | 649 writeStandardPrefix(ts, root, indent); |
652 ts << root << "\n"; | 650 ts << root << "\n"; |
653 writeChildren(ts, root, indent); | 651 writeChildren(ts, root, indent); |
654 } | 652 } |
655 | 653 |
656 void writeSVGText(TextStream& ts, const LayoutSVGText& text, int indent) { | 654 void writeSVGText(TextStream& ts, const LayoutSVGText& text, int indent) { |
657 writeStandardPrefix(ts, text, indent); | 655 writeStandardPrefix(ts, text, indent); |
| 656 writePositionAndStyle(ts, text); |
658 writeLayoutSVGTextBox(ts, text); | 657 writeLayoutSVGTextBox(ts, text); |
659 ts << "\n"; | 658 ts << "\n"; |
660 writeResources(ts, text, indent); | 659 writeResources(ts, text, indent); |
661 writeChildren(ts, text, indent); | 660 writeChildren(ts, text, indent); |
662 } | 661 } |
663 | 662 |
664 void writeSVGInlineText(TextStream& ts, | 663 void writeSVGInlineText(TextStream& ts, |
665 const LayoutSVGInlineText& text, | 664 const LayoutSVGInlineText& text, |
666 int indent) { | 665 int indent) { |
667 writeStandardPrefix(ts, text, indent); | 666 writeStandardPrefix(ts, text, indent); |
668 ts << " " << enclosingIntRect(FloatRect(text.firstRunOrigin(), | 667 writePositionAndStyle(ts, text); |
669 text.floatLinesBoundingBox().size())) | 668 ts << "\n"; |
670 << "\n"; | |
671 writeResources(ts, text, indent); | 669 writeResources(ts, text, indent); |
672 writeSVGInlineTextBoxes(ts, text, indent); | 670 writeSVGInlineTextBoxes(ts, text, indent); |
673 } | 671 } |
674 | 672 |
675 void writeSVGImage(TextStream& ts, const LayoutSVGImage& image, int indent) { | 673 void writeSVGImage(TextStream& ts, const LayoutSVGImage& image, int indent) { |
676 writeStandardPrefix(ts, image, indent); | 674 writeStandardPrefix(ts, image, indent); |
677 writePositionAndStyle(ts, image); | 675 writePositionAndStyle(ts, image); |
678 ts << "\n"; | 676 ts << "\n"; |
679 writeResources(ts, image, indent); | 677 writeResources(ts, image, indent); |
680 } | 678 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 ts << " "; | 753 ts << " "; |
756 writeStandardPrefix(ts, *filter, 0); | 754 writeStandardPrefix(ts, *filter, 0); |
757 ts << " " << filter->resourceBoundingBox(&object) << "\n"; | 755 ts << " " << filter->resourceBoundingBox(&object) << "\n"; |
758 } | 756 } |
759 } | 757 } |
760 } | 758 } |
761 } | 759 } |
762 } | 760 } |
763 | 761 |
764 } // namespace blink | 762 } // namespace blink |
OLD | NEW |