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

Unified Diff: Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl

Issue 361543002: Remove SVGPaint (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Give SVGPaintType a new home Created 6 years, 6 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
Index: Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl
diff --git a/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl b/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl
index 5672e52a1fb427b10f968bed4e57ea09fbb7b019..ee199997ce863f6df7080ab973911689887bd219 100644
--- a/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl
+++ b/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl
@@ -596,19 +596,39 @@ static bool lengthTypeAndValueMatch(const BorderImageLengthBox& borderImageLengt
{{declare_value_function(property_id)}}
{
- if (value->isSVGPaint()) {
- SVGPaint* svgPaint = toSVGPaint(value);
-
- Color color;
- if (svgPaint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR
- || svgPaint->paintType() == SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR)
- color = state.style()->color();
- else
- color = svgPaint->color();
-
- {{set_value(property)}}(svgPaint->paintType(),
- color,
- svgPaint->uri(),
+ String url;
+ if (value->isValueList()) {
+ CSSValueList* list = toCSSValueList(value);
+ if (list->length() < 2)
krit 2014/07/01 06:01:55 Could you add an assert list->length() > 2? It isn
+ return;
+
+ if (!list->item(0)->isPrimitiveValue())
+ return;
+
+ CSSPrimitiveValue* pValue = toCSSPrimitiveValue(list->item(0));
+ if (!pValue->isURI())
+ return;
+
+ url = pValue->getStringValue();
+ value = list->item(1);
+ }
+ if (value->isPrimitiveValue()) {
+ CSSPrimitiveValue* pValue = toCSSPrimitiveValue(value);
+ Color c;
+ SVGPaintType ptype = SVG_PAINTTYPE_RGBCOLOR;
+ if (pValue->isRGBColor()) {
+ c = pValue->getRGBA32Value();
+ ptype = url.isEmpty() ? SVG_PAINTTYPE_RGBCOLOR : SVG_PAINTTYPE_URI_RGBCOLOR;
+ } else if (pValue->getValueID() == CSSValueCurrentcolor) {
+ c = state.style()->color();
+ ptype = url.isEmpty() ? SVG_PAINTTYPE_CURRENTCOLOR : SVG_PAINTTYPE_URI_CURRENTCOLOR;
+ } else if (pValue->getValueID() == CSSValueNone)
+ ptype = url.isEmpty() ? SVG_PAINTTYPE_NONE : SVG_PAINTTYPE_URI_NONE;
+ else if (pValue->isURI()) {
+ ptype = SVG_PAINTTYPE_URI;
+ url = pValue->getStringValue();
+ }
krit 2014/07/01 06:01:55 Don't you want to add an else with a return?
+ {{set_value(property)}}(ptype, c, url,
state.applyPropertyToRegularStyle(),
state.applyPropertyToVisitedLinkStyle());
}

Powered by Google App Engine
This is Rietveld 408576698