Index: Source/core/rendering/svg/SVGRenderTreeAsText.cpp |
diff --git a/Source/core/rendering/svg/SVGRenderTreeAsText.cpp b/Source/core/rendering/svg/SVGRenderTreeAsText.cpp |
index 2ac4a3465b3dcd6c784eb332f25e5ab9617a53bc..61beb73cf7efe70656a8fbd6dddb3fa993c48eb1 100644 |
--- a/Source/core/rendering/svg/SVGRenderTreeAsText.cpp |
+++ b/Source/core/rendering/svg/SVGRenderTreeAsText.cpp |
@@ -42,7 +42,6 @@ |
#include "core/rendering/svg/RenderSVGResourceMasker.h" |
#include "core/rendering/svg/RenderSVGResourcePattern.h" |
#include "core/rendering/svg/RenderSVGResourceRadialGradient.h" |
-#include "core/rendering/svg/RenderSVGResourceSolidColor.h" |
#include "core/rendering/svg/RenderSVGRoot.h" |
#include "core/rendering/svg/RenderSVGShape.h" |
#include "core/rendering/svg/RenderSVGText.h" |
@@ -246,13 +245,15 @@ static TextStream& operator<<(TextStream& ts, const SVGSpreadMethodType& type) |
return ts; |
} |
-static void writeSVGPaintingResource(TextStream& ts, RenderSVGResource* resource) |
+static void writeSVGPaintingResource(TextStream& ts, const SVGPaintDescription& paintDescription) |
{ |
- if (resource->resourceType() == SolidColorResourceType) { |
- ts << "[type=SOLID] [color=" << static_cast<RenderSVGResourceSolidColor*>(resource)->color() << "]"; |
+ ASSERT(paintDescription.isValid); |
+ if (!paintDescription.resource) { |
+ ts << "[type=SOLID] [color=" << paintDescription.color << "]"; |
return; |
} |
+ RenderSVGResource* resource = paintDescription.resource; |
// All other resources derive from RenderSVGResourceContainer |
RenderSVGResourceContainer* container = static_cast<RenderSVGResourceContainer*>(resource); |
SVGElement* element = container->element(); |
@@ -281,11 +282,11 @@ static void writeStyle(TextStream& ts, const RenderObject& object) |
const RenderSVGShape& shape = static_cast<const RenderSVGShape&>(object); |
ASSERT(shape.element()); |
- bool hasFallback; |
- if (RenderSVGResource* strokePaintingResource = RenderSVGResource::requestPaintingResource(ApplyToStrokeMode, shape, shape.style(), hasFallback)) { |
+ SVGPaintDescription strokePaintDescription = RenderSVGResource::requestPaintDescription(shape, shape.style(), ApplyToStrokeMode); |
+ if (strokePaintDescription.isValid) { |
TextStreamSeparator s(" "); |
ts << " [stroke={" << s; |
- writeSVGPaintingResource(ts, strokePaintingResource); |
+ writeSVGPaintingResource(ts, strokePaintDescription); |
SVGLengthContext lengthContext(shape.element()); |
double dashOffset = svgStyle.strokeDashOffset()->value(lengthContext); |
@@ -310,10 +311,11 @@ static void writeStyle(TextStream& ts, const RenderObject& object) |
ts << "}]"; |
} |
- if (RenderSVGResource* fillPaintingResource = RenderSVGResource::requestPaintingResource(ApplyToFillMode, shape, shape.style(), hasFallback)) { |
+ SVGPaintDescription fillPaintDescription = RenderSVGResource::requestPaintDescription(shape, shape.style(), ApplyToFillMode); |
+ if (fillPaintDescription.isValid) { |
TextStreamSeparator s(" "); |
ts << " [fill={" << s; |
- writeSVGPaintingResource(ts, fillPaintingResource); |
+ writeSVGPaintingResource(ts, fillPaintDescription); |
writeIfNotDefault(ts, "opacity", svgStyle.fillOpacity(), 1.0f); |
writeIfNotDefault(ts, "fill rule", svgStyle.fillRule(), RULE_NONZERO); |