| 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 14 matching lines...) Expand all Loading... |
| 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 #include "config.h" | 29 #include "config.h" |
| 30 | 30 |
| 31 #include "core/layout/svg/SVGLayoutTreeAsText.h" | 31 #include "core/layout/svg/SVGLayoutTreeAsText.h" |
| 32 | 32 |
| 33 #include "core/layout/LayoutTreeAsText.h" | 33 #include "core/layout/LayoutTreeAsText.h" |
| 34 #include "core/layout/line/InlineTextBox.h" | 34 #include "core/layout/line/InlineTextBox.h" |
| 35 #include "core/layout/svg/LayoutSVGImage.h" |
| 35 #include "core/layout/svg/LayoutSVGInlineText.h" | 36 #include "core/layout/svg/LayoutSVGInlineText.h" |
| 36 #include "core/layout/svg/LayoutSVGResourceClipper.h" | 37 #include "core/layout/svg/LayoutSVGResourceClipper.h" |
| 37 #include "core/layout/svg/LayoutSVGResourceFilter.h" | 38 #include "core/layout/svg/LayoutSVGResourceFilter.h" |
| 38 #include "core/layout/svg/LayoutSVGResourceLinearGradient.h" | 39 #include "core/layout/svg/LayoutSVGResourceLinearGradient.h" |
| 39 #include "core/layout/svg/LayoutSVGResourceMarker.h" | 40 #include "core/layout/svg/LayoutSVGResourceMarker.h" |
| 40 #include "core/layout/svg/LayoutSVGResourceMasker.h" | 41 #include "core/layout/svg/LayoutSVGResourceMasker.h" |
| 41 #include "core/layout/svg/LayoutSVGResourcePattern.h" | 42 #include "core/layout/svg/LayoutSVGResourcePattern.h" |
| 42 #include "core/layout/svg/LayoutSVGResourceRadialGradient.h" | 43 #include "core/layout/svg/LayoutSVGResourceRadialGradient.h" |
| 44 #include "core/layout/svg/LayoutSVGShape.h" |
| 43 #include "core/layout/svg/LayoutSVGText.h" | 45 #include "core/layout/svg/LayoutSVGText.h" |
| 44 #include "core/layout/svg/line/SVGInlineTextBox.h" | 46 #include "core/layout/svg/line/SVGInlineTextBox.h" |
| 45 #include "core/layout/svg/line/SVGRootInlineBox.h" | 47 #include "core/layout/svg/line/SVGRootInlineBox.h" |
| 46 #include "core/rendering/svg/RenderSVGGradientStop.h" | 48 #include "core/rendering/svg/RenderSVGGradientStop.h" |
| 47 #include "core/rendering/svg/RenderSVGImage.h" | |
| 48 #include "core/rendering/svg/RenderSVGRoot.h" | 49 #include "core/rendering/svg/RenderSVGRoot.h" |
| 49 #include "core/rendering/svg/RenderSVGShape.h" | |
| 50 #include "core/svg/LinearGradientAttributes.h" | 50 #include "core/svg/LinearGradientAttributes.h" |
| 51 #include "core/svg/PatternAttributes.h" | 51 #include "core/svg/PatternAttributes.h" |
| 52 #include "core/svg/RadialGradientAttributes.h" | 52 #include "core/svg/RadialGradientAttributes.h" |
| 53 #include "core/svg/SVGCircleElement.h" | 53 #include "core/svg/SVGCircleElement.h" |
| 54 #include "core/svg/SVGEllipseElement.h" | 54 #include "core/svg/SVGEllipseElement.h" |
| 55 #include "core/svg/SVGLineElement.h" | 55 #include "core/svg/SVGLineElement.h" |
| 56 #include "core/svg/SVGLinearGradientElement.h" | 56 #include "core/svg/SVGLinearGradientElement.h" |
| 57 #include "core/svg/SVGPathElement.h" | 57 #include "core/svg/SVGPathElement.h" |
| 58 #include "core/svg/SVGPathUtilities.h" | 58 #include "core/svg/SVGPathUtilities.h" |
| 59 #include "core/svg/SVGPatternElement.h" | 59 #include "core/svg/SVGPatternElement.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 static void writeStyle(TextStream& ts, const LayoutObject& object) | 271 static void writeStyle(TextStream& ts, const LayoutObject& object) |
| 272 { | 272 { |
| 273 const LayoutStyle& style = object.styleRef(); | 273 const LayoutStyle& style = object.styleRef(); |
| 274 const SVGLayoutStyle& svgStyle = style.svgStyle(); | 274 const SVGLayoutStyle& svgStyle = style.svgStyle(); |
| 275 | 275 |
| 276 if (!object.localTransform().isIdentity()) | 276 if (!object.localTransform().isIdentity()) |
| 277 writeNameValuePair(ts, "transform", object.localTransform()); | 277 writeNameValuePair(ts, "transform", object.localTransform()); |
| 278 writeIfNotDefault(ts, "image rendering", style.imageRendering(), LayoutStyle
::initialImageRendering()); | 278 writeIfNotDefault(ts, "image rendering", style.imageRendering(), LayoutStyle
::initialImageRendering()); |
| 279 writeIfNotDefault(ts, "opacity", style.opacity(), LayoutStyle::initialOpacit
y()); | 279 writeIfNotDefault(ts, "opacity", style.opacity(), LayoutStyle::initialOpacit
y()); |
| 280 if (object.isSVGShape()) { | 280 if (object.isSVGShape()) { |
| 281 const RenderSVGShape& shape = static_cast<const RenderSVGShape&>(object)
; | 281 const LayoutSVGShape& shape = static_cast<const LayoutSVGShape&>(object)
; |
| 282 ASSERT(shape.element()); | 282 ASSERT(shape.element()); |
| 283 | 283 |
| 284 SVGPaintDescription strokePaintDescription = LayoutSVGResourcePaintServe
r::requestPaintDescription(shape, shape.styleRef(), ApplyToStrokeMode); | 284 SVGPaintDescription strokePaintDescription = LayoutSVGResourcePaintServe
r::requestPaintDescription(shape, shape.styleRef(), ApplyToStrokeMode); |
| 285 if (strokePaintDescription.isValid) { | 285 if (strokePaintDescription.isValid) { |
| 286 TextStreamSeparator s(" "); | 286 TextStreamSeparator s(" "); |
| 287 ts << " [stroke={" << s; | 287 ts << " [stroke={" << s; |
| 288 writeSVGPaintingResource(ts, strokePaintDescription); | 288 writeSVGPaintingResource(ts, strokePaintDescription); |
| 289 | 289 |
| 290 SVGLengthContext lengthContext(shape.element()); | 290 SVGLengthContext lengthContext(shape.element()); |
| 291 double dashOffset = svgStyle.strokeDashOffset()->value(lengthContext
); | 291 double dashOffset = svgStyle.strokeDashOffset()->value(lengthContext
); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 writeIfNotEmpty(ts, "end marker", svgStyle.markerEndResource()); | 328 writeIfNotEmpty(ts, "end marker", svgStyle.markerEndResource()); |
| 329 } | 329 } |
| 330 | 330 |
| 331 static TextStream& writePositionAndStyle(TextStream& ts, const LayoutObject& obj
ect) | 331 static TextStream& writePositionAndStyle(TextStream& ts, const LayoutObject& obj
ect) |
| 332 { | 332 { |
| 333 ts << " " << enclosingIntRect(const_cast<LayoutObject&>(object).absoluteClip
pedOverflowRect()); | 333 ts << " " << enclosingIntRect(const_cast<LayoutObject&>(object).absoluteClip
pedOverflowRect()); |
| 334 writeStyle(ts, object); | 334 writeStyle(ts, object); |
| 335 return ts; | 335 return ts; |
| 336 } | 336 } |
| 337 | 337 |
| 338 static TextStream& operator<<(TextStream& ts, const RenderSVGShape& shape) | 338 static TextStream& operator<<(TextStream& ts, const LayoutSVGShape& shape) |
| 339 { | 339 { |
| 340 writePositionAndStyle(ts, shape); | 340 writePositionAndStyle(ts, shape); |
| 341 | 341 |
| 342 SVGElement* svgElement = shape.element(); | 342 SVGElement* svgElement = shape.element(); |
| 343 ASSERT(svgElement); | 343 ASSERT(svgElement); |
| 344 SVGLengthContext lengthContext(svgElement); | 344 SVGLengthContext lengthContext(svgElement); |
| 345 | 345 |
| 346 if (isSVGRectElement(*svgElement)) { | 346 if (isSVGRectElement(*svgElement)) { |
| 347 SVGRectElement& element = toSVGRectElement(*svgElement); | 347 SVGRectElement& element = toSVGRectElement(*svgElement); |
| 348 writeNameValuePair(ts, "x", element.x()->currentValue()->value(lengthCon
text)); | 348 writeNameValuePair(ts, "x", element.x()->currentValue()->value(lengthCon
text)); |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 } | 608 } |
| 609 | 609 |
| 610 void writeSVGInlineText(TextStream& ts, const LayoutSVGInlineText& text, int ind
ent) | 610 void writeSVGInlineText(TextStream& ts, const LayoutSVGInlineText& text, int ind
ent) |
| 611 { | 611 { |
| 612 writeStandardPrefix(ts, text, indent); | 612 writeStandardPrefix(ts, text, indent); |
| 613 ts << " " << enclosingIntRect(FloatRect(text.firstRunOrigin(), text.floatLin
esBoundingBox().size())) << "\n"; | 613 ts << " " << enclosingIntRect(FloatRect(text.firstRunOrigin(), text.floatLin
esBoundingBox().size())) << "\n"; |
| 614 writeResources(ts, text, indent); | 614 writeResources(ts, text, indent); |
| 615 writeSVGInlineTextBoxes(ts, text, indent); | 615 writeSVGInlineTextBoxes(ts, text, indent); |
| 616 } | 616 } |
| 617 | 617 |
| 618 void writeSVGImage(TextStream& ts, const RenderSVGImage& image, int indent) | 618 void writeSVGImage(TextStream& ts, const LayoutSVGImage& image, int indent) |
| 619 { | 619 { |
| 620 writeStandardPrefix(ts, image, indent); | 620 writeStandardPrefix(ts, image, indent); |
| 621 writePositionAndStyle(ts, image); | 621 writePositionAndStyle(ts, image); |
| 622 ts << "\n"; | 622 ts << "\n"; |
| 623 writeResources(ts, image, indent); | 623 writeResources(ts, image, indent); |
| 624 } | 624 } |
| 625 | 625 |
| 626 void write(TextStream& ts, const RenderSVGShape& shape, int indent) | 626 void write(TextStream& ts, const LayoutSVGShape& shape, int indent) |
| 627 { | 627 { |
| 628 writeStandardPrefix(ts, shape, indent); | 628 writeStandardPrefix(ts, shape, indent); |
| 629 ts << shape << "\n"; | 629 ts << shape << "\n"; |
| 630 writeResources(ts, shape, indent); | 630 writeResources(ts, shape, indent); |
| 631 } | 631 } |
| 632 | 632 |
| 633 void writeSVGGradientStop(TextStream& ts, const RenderSVGGradientStop& stop, int
indent) | 633 void writeSVGGradientStop(TextStream& ts, const RenderSVGGradientStop& stop, int
indent) |
| 634 { | 634 { |
| 635 writeStandardPrefix(ts, stop, indent); | 635 writeStandardPrefix(ts, stop, indent); |
| 636 | 636 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 ts << " "; | 675 ts << " "; |
| 676 writeNameAndQuotedValue(ts, "filter", svgStyle.filterResource()); | 676 writeNameAndQuotedValue(ts, "filter", svgStyle.filterResource()); |
| 677 ts << " "; | 677 ts << " "; |
| 678 writeStandardPrefix(ts, *filter, 0); | 678 writeStandardPrefix(ts, *filter, 0); |
| 679 ts << " " << filter->resourceBoundingBox(&renderer) << "\n"; | 679 ts << " " << filter->resourceBoundingBox(&renderer) << "\n"; |
| 680 } | 680 } |
| 681 } | 681 } |
| 682 } | 682 } |
| 683 | 683 |
| 684 } // namespace blink | 684 } // namespace blink |
| OLD | NEW |