From 0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5 Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Tue, 11 Aug 2009 17:01:47 +0100 Subject: Merge in WebKit r47029. --- WebCore/rendering/SVGRenderTreeAsText.cpp | 48 +++++++++++++------------------ 1 file changed, 20 insertions(+), 28 deletions(-) (limited to 'WebCore/rendering/SVGRenderTreeAsText.cpp') diff --git a/WebCore/rendering/SVGRenderTreeAsText.cpp b/WebCore/rendering/SVGRenderTreeAsText.cpp index 33baeba..28e506a 100644 --- a/WebCore/rendering/SVGRenderTreeAsText.cpp +++ b/WebCore/rendering/SVGRenderTreeAsText.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2007, 2009 Apple Inc. All rights reserved. * (C) 2005 Rob Buis * (C) 2006 Alexander Kellett * @@ -31,14 +31,15 @@ #include "SVGRenderTreeAsText.h" #include "GraphicsTypes.h" -#include "InlineTextBox.h" #include "HTMLNames.h" +#include "InlineTextBox.h" +#include "NodeRenderStyle.h" +#include "RenderImage.h" #include "RenderPath.h" #include "RenderSVGContainer.h" -#include "RenderSVGImage.h" #include "RenderSVGInlineText.h" -#include "RenderSVGText.h" #include "RenderSVGRoot.h" +#include "RenderSVGText.h" #include "RenderTreeAsText.h" #include "SVGCharacterLayoutInfo.h" #include "SVGInlineTextBox.h" @@ -272,7 +273,7 @@ static void writeStyle(TextStream& ts, const RenderObject& object) ts << s << *strokePaintServer; double dashOffset = SVGRenderStyle::cssPrimitiveToLength(&path, svgStyle->strokeDashOffset(), 0.0f); - const DashArray& dashArray = dashArrayFromRenderingStyle(style); + const DashArray& dashArray = dashArrayFromRenderingStyle(style, object.document()->documentElement()->renderStyle()); double strokeWidth = SVGRenderStyle::cssPrimitiveToLength(&path, svgStyle->strokeWidth(), 1.0f); writeIfNotDefault(ts, "opacity", svgStyle->strokeOpacity(), 1.0f); @@ -321,35 +322,23 @@ static TextStream& operator<<(TextStream& ts, const RenderPath& path) return ts; } -static TextStream& operator<<(TextStream& ts, const RenderSVGContainer& container) -{ - return writePositionAndStyle(ts, container); -} - static TextStream& operator<<(TextStream& ts, const RenderSVGRoot& root) { return writePositionAndStyle(ts, root); } -static TextStream& operator<<(TextStream& ts, const RenderSVGImage& root) -{ - return writePositionAndStyle(ts, root); -} - -static TextStream& operator<<(TextStream& ts, const RenderSVGText& text) +static void writeRenderSVGTextBox(TextStream& ts, const RenderBlock& text) { SVGRootInlineBox* box = static_cast(text.firstRootBox()); if (!box) - return ts; + return; Vector& chunks = const_cast& >(box->svgTextChunks()); ts << " at (" << text.x() << "," << text.y() << ") size " << box->width() << "x" << box->height() << " contains " << chunks.size() << " chunk(s)"; if (text.parent() && (text.parent()->style()->color() != text.style()->color())) writeNameValuePair(ts, "color", text.style()->color().name()); - - return ts; } static inline bool containsInlineTextBox(SVGTextChunk& chunk, SVGInlineTextBox* box) @@ -454,7 +443,7 @@ static inline void writeSVGInlineTextBox(TextStream& ts, SVGInlineTextBox* textB } } -static inline void writeSVGInlineText(TextStream& ts, const RenderSVGInlineText& text, int indent) +static inline void writeSVGInlineTextBoxes(TextStream& ts, const RenderText& text, int indent) { for (InlineTextBox* box = text.firstTextBox(); box; box = box->nextTextBox()) writeSVGInlineTextBox(ts, static_cast(box), indent); @@ -475,10 +464,11 @@ static void writeChildren(TextStream& ts, const RenderObject& object, int indent write(ts, *child, indent + 1); } -void write(TextStream& ts, const RenderSVGContainer& container, int indent) +void writeSVGContainer(TextStream& ts, const RenderObject& container, int indent) { writeStandardPrefix(ts, container, indent); - ts << container << "\n"; + writePositionAndStyle(ts, container); + ts << "\n"; writeChildren(ts, container, indent); } @@ -489,20 +479,21 @@ void write(TextStream& ts, const RenderSVGRoot& root, int indent) writeChildren(ts, root, indent); } -void write(TextStream& ts, const RenderSVGText& text, int indent) +void writeSVGText(TextStream& ts, const RenderBlock& text, int indent) { writeStandardPrefix(ts, text, indent); - ts << text << "\n"; + writeRenderSVGTextBox(ts, text); + ts << "\n"; writeChildren(ts, text, indent); } -void write(TextStream& ts, const RenderSVGInlineText& text, int indent) +void writeSVGInlineText(TextStream& ts, const RenderText& text, int indent) { writeStandardPrefix(ts, text, indent); // Why not just linesBoundingBox()? ts << " " << FloatRect(text.firstRunOrigin(), text.linesBoundingBox().size()) << "\n"; - writeSVGInlineText(ts, text, indent); + writeSVGInlineTextBoxes(ts, text, indent); } void write(TextStream& ts, const RenderPath& path, int indent) @@ -511,10 +502,11 @@ void write(TextStream& ts, const RenderPath& path, int indent) ts << path << "\n"; } -void write(TextStream& ts, const RenderSVGImage& image, int indent) +void writeSVGImage(TextStream& ts, const RenderImage& image, int indent) { writeStandardPrefix(ts, image, indent); - ts << image << "\n"; + writePositionAndStyle(ts, image); + ts << "\n"; } void writeRenderResources(TextStream& ts, Node* parent) -- cgit v1.1