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

Unified Diff: Source/core/rendering/svg/SVGRenderTreeAsText.cpp

Issue 658333003: Make RenderSVGResource::requestPaintingResource an implementation detail (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Drop SolidColorResourceType. Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
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..232bc61a39923feb92f840c51826bc1752e97c44 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 RenderSVGResource::PaintDescription& 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)) {
+ RenderSVGResource::PaintDescription strokePaintDescription = RenderSVGResource::requestPaint(ApplyToStrokeMode, shape, shape.style());
+ 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)) {
+ RenderSVGResource::PaintDescription fillPaintDescription = RenderSVGResource::requestPaint(ApplyToFillMode, shape, shape.style());
+ 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);

Powered by Google App Engine
This is Rietveld 408576698