Index: Source/core/css/SVGCSSComputedStyleDeclaration.cpp |
diff --git a/Source/core/css/SVGCSSComputedStyleDeclaration.cpp b/Source/core/css/SVGCSSComputedStyleDeclaration.cpp |
index 584b67705a6306991b5ef164f9746e50e19fab8f..df1fd18bc1dabffe73653a305e4dcfea3d0348bf 100644 |
--- a/Source/core/css/SVGCSSComputedStyleDeclaration.cpp |
+++ b/Source/core/css/SVGCSSComputedStyleDeclaration.cpp |
@@ -83,12 +83,25 @@ static PassRefPtrWillBeRawPtr<CSSValue> paintOrderToCSSValueList(EPaintOrder pai |
return list.release(); |
} |
-PassRefPtrWillBeRawPtr<SVGPaint> CSSComputedStyleDeclaration::adjustSVGPaintForCurrentColor(PassRefPtrWillBeRawPtr<SVGPaint> newPaint, RenderStyle& style) const |
+PassRefPtrWillBeRawPtr<CSSValue> adjustSVGPaintForCurrentColor(SVGPaint::SVGPaintType ptype, const String& url, const Color& color, const Color& currentColor) |
{ |
- RefPtrWillBeRawPtr<SVGPaint> paint = newPaint; |
- if (paint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR || paint->paintType() == SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR) |
- paint->setColor(style.color()); |
- return paint.release(); |
+ if (ptype >= SVGPaint::SVG_PAINTTYPE_URI_NONE) { |
+ RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated(); |
+ values->append(CSSPrimitiveValue::create(url, CSSPrimitiveValue::CSS_URI)); |
+ if (ptype == SVGPaint::SVG_PAINTTYPE_URI_NONE) |
+ values->append(CSSPrimitiveValue::create(CSSValueNone)); |
+ else if (ptype == SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR) |
+ values->append(CSSPrimitiveValue::createColor(currentColor.rgb())); |
+ else if (ptype == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR) |
+ values->append(CSSPrimitiveValue::createColor(color.rgb())); |
+ return values.release(); |
+ } |
+ if (ptype == SVGPaint::SVG_PAINTTYPE_NONE) |
+ return CSSPrimitiveValue::create(CSSValueNone); |
+ if (ptype == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR) |
+ return CSSPrimitiveValue::createColor(currentColor.rgb()); |
+ |
+ return CSSPrimitiveValue::createColor(color.rgb()); |
} |
static inline String serializeAsFragmentIdentifier(const AtomicString& resource) |
@@ -168,7 +181,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSV |
case CSSPropertyStopColor: |
return currentColorOrValidColor(*style, svgStyle->stopColor()); |
case CSSPropertyFill: |
- return adjustSVGPaintForCurrentColor(SVGPaint::create(svgStyle->fillPaintType(), svgStyle->fillPaintUri(), svgStyle->fillPaintColor()), *style); |
+ return adjustSVGPaintForCurrentColor(svgStyle->fillPaintType(), svgStyle->fillPaintUri(), svgStyle->fillPaintColor(), style->color()); |
case CSSPropertyMarkerEnd: |
if (!svgStyle->markerEndResource().isEmpty()) |
return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgStyle->markerEndResource()), CSSPrimitiveValue::CSS_URI); |
@@ -182,7 +195,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSV |
return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(svgStyle->markerStartResource()), CSSPrimitiveValue::CSS_URI); |
return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
case CSSPropertyStroke: |
- return adjustSVGPaintForCurrentColor(SVGPaint::create(svgStyle->strokePaintType(), svgStyle->strokePaintUri(), svgStyle->strokePaintColor()), *style); |
+ return adjustSVGPaintForCurrentColor(svgStyle->strokePaintType(), svgStyle->strokePaintUri(), svgStyle->strokePaintColor(), style->color()); |
case CSSPropertyStrokeDasharray: |
return strokeDashArrayToCSSValueList(svgStyle->strokeDashArray()); |
case CSSPropertyStrokeDashoffset: |