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

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: requestPaintForDRT -> requestPaintDescription. 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
« no previous file with comments | « Source/core/rendering/svg/RenderSVGShape.cpp ('k') | Source/core/rendering/svg/SVGResources.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « Source/core/rendering/svg/RenderSVGShape.cpp ('k') | Source/core/rendering/svg/SVGResources.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698