Index: Source/core/rendering/svg/RenderSVGShape.cpp |
diff --git a/Source/core/rendering/svg/RenderSVGShape.cpp b/Source/core/rendering/svg/RenderSVGShape.cpp |
index d13bd6333907574b0a394b8d37eb023c402ad6cd..4b8a46ccd96cc56d6d3587188dc1e60e52810bdf 100644 |
--- a/Source/core/rendering/svg/RenderSVGShape.cpp |
+++ b/Source/core/rendering/svg/RenderSVGShape.cpp |
@@ -28,11 +28,11 @@ |
#include "config.h" |
#include "core/rendering/svg/RenderSVGShape.h" |
+#include "core/paint/SVGPaintServer.h" |
#include "core/rendering/GraphicsContextAnnotator.h" |
#include "core/rendering/HitTestRequest.h" |
#include "core/rendering/PointerEventsHitRules.h" |
#include "core/rendering/svg/RenderSVGResourceMarker.h" |
-#include "core/rendering/svg/RenderSVGResourceSolidColor.h" |
#include "core/rendering/svg/SVGPathData.h" |
#include "core/rendering/svg/SVGRenderSupport.h" |
#include "core/rendering/svg/SVGRenderingContext.h" |
@@ -112,8 +112,7 @@ bool RenderSVGShape::fillContains(const FloatPoint& point, bool requiresFill, co |
if (!m_fillBoundingBox.contains(point)) |
return false; |
- bool hasFallback; |
- if (requiresFill && !RenderSVGResource::requestPaintingResource(ApplyToFillMode, this, style(), hasFallback)) |
+ if (requiresFill && !SVGPaintServer::existsForRenderer(*this, style(), ApplyToFillMode)) |
return false; |
return shapeDependentFillContains(point, fillRule); |
@@ -124,8 +123,7 @@ bool RenderSVGShape::strokeContains(const FloatPoint& point, bool requiresStroke |
if (!strokeBoundingBox().contains(point)) |
return false; |
- bool hasFallback; |
- if (requiresStroke && !RenderSVGResource::requestPaintingResource(ApplyToStrokeMode, this, style(), hasFallback)) |
+ if (requiresStroke && !SVGPaintServer::existsForRenderer(*this, style(), ApplyToStrokeMode)) |
return false; |
return shapeDependentStrokeContains(point); |
@@ -200,40 +198,6 @@ bool RenderSVGShape::shouldGenerateMarkerPositions() const |
return resources->markerStart() || resources->markerMid() || resources->markerEnd(); |
} |
-void RenderSVGShape::fillShape(RenderStyle* style, GraphicsContext* context) |
-{ |
- bool hasFallback; |
- if (RenderSVGResource* fillPaintingResource = RenderSVGResource::requestPaintingResource(ApplyToFillMode, this, style, hasFallback)) { |
- if (fillPaintingResource->applyResource(this, style, context, ApplyToFillMode)) { |
- fillShape(context); |
- fillPaintingResource->postApplyResource(context); |
- } else if (hasFallback) { |
- RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::sharedSolidPaintingResource(); |
- if (fallbackResource->applyResource(this, style, context, ApplyToFillMode)) { |
- fillShape(context); |
- fallbackResource->postApplyResource(context); |
- } |
- } |
- } |
-} |
- |
-void RenderSVGShape::strokeShape(RenderStyle* style, GraphicsContext* context) |
-{ |
- bool hasFallback; |
- if (RenderSVGResource* strokePaintingResource = RenderSVGResource::requestPaintingResource(ApplyToStrokeMode, this, style, hasFallback)) { |
- if (strokePaintingResource->applyResource(this, style, context, ApplyToStrokeMode)) { |
- strokeShape(context); |
- strokePaintingResource->postApplyResource(context); |
- } else if (hasFallback) { |
- RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::sharedSolidPaintingResource(); |
- if (fallbackResource->applyResource(this, style, context, ApplyToStrokeMode)) { |
- strokeShape(context); |
- fallbackResource->postApplyResource(context); |
- } |
- } |
- } |
-} |
- |
void RenderSVGShape::paint(PaintInfo& paintInfo, const LayoutPoint&) |
{ |
ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this); |
@@ -260,9 +224,13 @@ void RenderSVGShape::paint(PaintInfo& paintInfo, const LayoutPoint&) |
for (int i = 0; i < 3; i++) { |
switch (svgStyle.paintOrderType(i)) { |
- case PT_FILL: |
- fillShape(this->style(), childPaintInfo.context); |
+ case PT_FILL: { |
+ GraphicsContextStateSaver stateSaver(*childPaintInfo.context, false); |
+ if (!SVGPaintServer::updateGraphicsContext(childPaintInfo.context, style(), *this, ApplyToFillMode, stateSaver)) |
+ break; |
+ fillShape(childPaintInfo.context); |
break; |
+ } |
case PT_STROKE: |
if (svgStyle.hasVisibleStroke()) { |
GraphicsContextStateSaver stateSaver(*childPaintInfo.context, false); |
@@ -274,7 +242,9 @@ void RenderSVGShape::paint(PaintInfo& paintInfo, const LayoutPoint&) |
return; |
} |
- strokeShape(this->style(), childPaintInfo.context); |
+ if (!SVGPaintServer::updateGraphicsContext(childPaintInfo.context, style(), *this, ApplyToStrokeMode, stateSaver)) |
+ break; |
+ strokeShape(childPaintInfo.context); |
} |
break; |
case PT_MARKERS: |