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

Unified Diff: Source/core/css/SVGCSSComputedStyleDeclaration.cpp

Issue 361543002: Remove SVGPaint (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing Created 6 years, 5 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/css/CSSValue.cpp ('k') | Source/core/css/parser/BisonCSSParser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/SVGCSSComputedStyleDeclaration.cpp
diff --git a/Source/core/css/SVGCSSComputedStyleDeclaration.cpp b/Source/core/css/SVGCSSComputedStyleDeclaration.cpp
index 584b67705a6306991b5ef164f9746e50e19fab8f..4435910a19dc654d650f394e27255bc1165bdfc6 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
+static PassRefPtrWillBeRawPtr<CSSValue> adjustSVGPaintForCurrentColor(SVGPaintType paintType, 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 (paintType >= SVG_PAINTTYPE_URI_NONE) {
+ RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated();
+ values->append(CSSPrimitiveValue::create(url, CSSPrimitiveValue::CSS_URI));
+ if (paintType == SVG_PAINTTYPE_URI_NONE)
+ values->append(CSSPrimitiveValue::create(CSSValueNone));
+ else if (paintType == SVG_PAINTTYPE_URI_CURRENTCOLOR)
+ values->append(CSSPrimitiveValue::createColor(currentColor.rgb()));
+ else if (paintType == SVG_PAINTTYPE_URI_RGBCOLOR)
+ values->append(CSSPrimitiveValue::createColor(color.rgb()));
+ return values.release();
+ }
+ if (paintType == SVG_PAINTTYPE_NONE)
+ return CSSPrimitiveValue::create(CSSValueNone);
+ if (paintType == 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:
« no previous file with comments | « Source/core/css/CSSValue.cpp ('k') | Source/core/css/parser/BisonCSSParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698