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

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

Issue 673753004: Move RenderSVGResource into the inheritance hierarchy (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Non-move changes. 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/SVGResources.h ('k') | Source/core/rendering/svg/SVGResourcesCycleSolver.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/svg/SVGResources.cpp
diff --git a/Source/core/rendering/svg/SVGResources.cpp b/Source/core/rendering/svg/SVGResources.cpp
index 25f45283f05bd1fbdff5e204e22eec5e21bd82c8..65f4bb2061b325db3a2073c431bf0b7e1df87ac6 100644
--- a/Source/core/rendering/svg/SVGResources.cpp
+++ b/Source/core/rendering/svg/SVGResources.cpp
@@ -26,6 +26,7 @@
#include "core/rendering/svg/RenderSVGResourceFilter.h"
#include "core/rendering/svg/RenderSVGResourceMarker.h"
#include "core/rendering/svg/RenderSVGResourceMasker.h"
+#include "core/rendering/svg/RenderSVGResourcePaintServer.h"
#include "core/svg/SVGFilterElement.h"
#include "core/svg/SVGGradientElement.h"
#include "core/svg/SVGPatternElement.h"
@@ -175,7 +176,7 @@ static inline bool svgPaintTypeHasURL(SVGPaintType paintType)
return false;
}
-static inline RenderSVGResourceContainer* paintingResourceFromSVGPaint(TreeScope& treeScope, const SVGPaintType& paintType, const String& paintUri, AtomicString& id, bool& hasPendingResource)
+static inline RenderSVGResourcePaintServer* paintingResourceFromSVGPaint(TreeScope& treeScope, const SVGPaintType& paintType, const String& paintUri, AtomicString& id, bool& hasPendingResource)
{
if (!svgPaintTypeHasURL(paintType))
return 0;
@@ -187,11 +188,10 @@ static inline RenderSVGResourceContainer* paintingResourceFromSVGPaint(TreeScope
return 0;
}
- RenderSVGResourceType resourceType = container->resourceType();
- if (resourceType != PatternResourceType && resourceType != LinearGradientResourceType && resourceType != RadialGradientResourceType)
+ if (!container->isSVGPaintServer())
return 0;
- return container;
+ return toRenderSVGResourcePaintServer(container);
}
static inline void registerPendingResource(SVGDocumentExtensions& extensions, const AtomicString& id, SVGElement* element)
@@ -275,7 +275,7 @@ PassOwnPtr<SVGResources> SVGResources::buildResources(const RenderObject* object
if (style.hasFill()) {
bool hasPendingResource = false;
AtomicString id;
- RenderSVGResourceContainer* resource = paintingResourceFromSVGPaint(treeScope, style.fillPaintType(), style.fillPaintUri(), id, hasPendingResource);
+ RenderSVGResourcePaintServer* resource = paintingResourceFromSVGPaint(treeScope, style.fillPaintType(), style.fillPaintUri(), id, hasPendingResource);
if (!ensureResources(resources)->setFill(resource) && hasPendingResource) {
registerPendingResource(extensions, id, element);
}
@@ -284,7 +284,7 @@ PassOwnPtr<SVGResources> SVGResources::buildResources(const RenderObject* object
if (style.hasStroke()) {
bool hasPendingResource = false;
AtomicString id;
- RenderSVGResourceContainer* resource = paintingResourceFromSVGPaint(treeScope, style.strokePaintType(), style.strokePaintUri(), id, hasPendingResource);
+ RenderSVGResourcePaintServer* resource = paintingResourceFromSVGPaint(treeScope, style.strokePaintType(), style.strokePaintUri(), id, hasPendingResource);
if (!ensureResources(resources)->setStroke(resource) && hasPendingResource) {
registerPendingResource(extensions, id, element);
}
@@ -321,9 +321,9 @@ void SVGResources::layoutIfNeeded()
}
if (m_fillStrokeData) {
- if (RenderSVGResourceContainer* fill = m_fillStrokeData->fill)
+ if (RenderSVGResourcePaintServer* fill = m_fillStrokeData->fill)
fill->layoutIfNeeded();
- if (RenderSVGResourceContainer* stroke = m_fillStrokeData->stroke)
+ if (RenderSVGResourcePaintServer* stroke = m_fillStrokeData->stroke)
stroke->layoutIfNeeded();
}
@@ -610,15 +610,11 @@ void SVGResources::resetMasker()
m_clipperFilterMaskerData->masker = 0;
}
-bool SVGResources::setFill(RenderSVGResourceContainer* fill)
+bool SVGResources::setFill(RenderSVGResourcePaintServer* fill)
{
if (!fill)
return false;
- ASSERT(fill->resourceType() == PatternResourceType
- || fill->resourceType() == LinearGradientResourceType
- || fill->resourceType() == RadialGradientResourceType);
-
if (!m_fillStrokeData)
m_fillStrokeData = FillStrokeData::create();
@@ -633,15 +629,11 @@ void SVGResources::resetFill()
m_fillStrokeData->fill = 0;
}
-bool SVGResources::setStroke(RenderSVGResourceContainer* stroke)
+bool SVGResources::setStroke(RenderSVGResourcePaintServer* stroke)
{
if (!stroke)
return false;
- ASSERT(stroke->resourceType() == PatternResourceType
- || stroke->resourceType() == LinearGradientResourceType
- || stroke->resourceType() == RadialGradientResourceType);
-
if (!m_fillStrokeData)
m_fillStrokeData = FillStrokeData::create();
@@ -701,9 +693,9 @@ void SVGResources::dump(const RenderObject* object)
}
if (m_fillStrokeData) {
- if (RenderSVGResourceContainer* fill = m_fillStrokeData->fill)
+ if (RenderSVGResourcePaintServer* fill = m_fillStrokeData->fill)
fprintf(stderr, " |-> Fill : %p (node=%p)\n", fill, fill->element());
- if (RenderSVGResourceContainer* stroke = m_fillStrokeData->stroke)
+ if (RenderSVGResourcePaintServer* stroke = m_fillStrokeData->stroke)
fprintf(stderr, " |-> Stroke : %p (node=%p)\n", stroke, stroke->element());
}
« no previous file with comments | « Source/core/rendering/svg/SVGResources.h ('k') | Source/core/rendering/svg/SVGResourcesCycleSolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698