Chromium Code Reviews| Index: Source/core/css/SVGCSSComputedStyleDeclaration.cpp |
| diff --git a/Source/core/css/SVGCSSComputedStyleDeclaration.cpp b/Source/core/css/SVGCSSComputedStyleDeclaration.cpp |
| index 584b67705a6306991b5ef164f9746e50e19fab8f..edd4aa691819930449139516f6f3089f55e3c6c4 100644 |
| --- a/Source/core/css/SVGCSSComputedStyleDeclaration.cpp |
| +++ b/Source/core/css/SVGCSSComputedStyleDeclaration.cpp |
| @@ -26,7 +26,6 @@ |
| #include "core/css/CSSPrimitiveValueMappings.h" |
| #include "core/dom/Document.h" |
| #include "core/rendering/style/RenderStyle.h" |
| -#include "core/svg/SVGPaint.h" |
| namespace WebCore { |
| @@ -83,12 +82,25 @@ static PassRefPtrWillBeRawPtr<CSSValue> paintOrderToCSSValueList(EPaintOrder pai |
| return list.release(); |
| } |
| -PassRefPtrWillBeRawPtr<SVGPaint> CSSComputedStyleDeclaration::adjustSVGPaintForCurrentColor(PassRefPtrWillBeRawPtr<SVGPaint> newPaint, RenderStyle& style) const |
| +PassRefPtrWillBeRawPtr<CSSValue> adjustSVGPaintForCurrentColor(SVGPaintType ptype, const String& url, const Color& color, const Color& currentColor) |
|
fs
2014/07/01 07:52:12
Nit: Make static?
|
| { |
| - 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 >= SVG_PAINTTYPE_URI_NONE) { |
| + RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated(); |
|
krit
2014/07/01 06:01:55
This always creates a CSSValueList if color is inv
|
| + values->append(CSSPrimitiveValue::create(url, CSSPrimitiveValue::CSS_URI)); |
| + if (ptype == SVG_PAINTTYPE_URI_NONE) |
| + values->append(CSSPrimitiveValue::create(CSSValueNone)); |
| + else if (ptype == SVG_PAINTTYPE_URI_CURRENTCOLOR) |
| + values->append(CSSPrimitiveValue::createColor(currentColor.rgb())); |
| + else if (ptype == SVG_PAINTTYPE_URI_RGBCOLOR) |
| + values->append(CSSPrimitiveValue::createColor(color.rgb())); |
| + return values.release(); |
| + } |
| + if (ptype == SVG_PAINTTYPE_NONE) |
| + return CSSPrimitiveValue::create(CSSValueNone); |
| + if (ptype == SVG_PAINTTYPE_CURRENTCOLOR) |
| + return CSSPrimitiveValue::createColor(currentColor.rgb()); |
| + |
| + return CSSPrimitiveValue::createColor(color.rgb()); |
| } |
| static inline String serializeAsFragmentIdentifier(const AtomicString& resource) |
| @@ -168,7 +180,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 +194,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: |