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

Side by Side Diff: third_party/WebKit/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl

Issue 1376573004: Split out Color from CSSPrimitiveValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@split_property
Patch Set: Rebase and review feedback Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/animation/ColorInterpolationType.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 {% from 'macros.tmpl' import license %} 1 {% from 'macros.tmpl' import license %}
2 {# 2 {#
3 This file is for property handlers which use the templating engine to 3 This file is for property handlers which use the templating engine to
4 reduce (handwritten) code duplication. 4 reduce (handwritten) code duplication.
5 5
6 The `properties' dict can be used to access a property's parameters in 6 The `properties' dict can be used to access a property's parameters in
7 jinja2 templates (i.e. setter, getter, initial, type_name) 7 jinja2 templates (i.e. setter, getter, initial, type_name)
8 #} 8 #}
9 #include "config.h" 9 #include "config.h"
10 #include "StyleBuilderFunctions.h" 10 #include "StyleBuilderFunctions.h"
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 ASSERT(list->length() == 2); 508 ASSERT(list->length() == 2);
509 url = toCSSURIValue(list->item(0))->value(); 509 url = toCSSURIValue(list->item(0))->value();
510 value = list->item(1); 510 value = list->item(1);
511 } 511 }
512 512
513 Color color; 513 Color color;
514 SVGPaintType paintType = SVG_PAINTTYPE_RGBCOLOR; 514 SVGPaintType paintType = SVG_PAINTTYPE_RGBCOLOR;
515 if (value->isURIValue()) { 515 if (value->isURIValue()) {
516 paintType = SVG_PAINTTYPE_URI; 516 paintType = SVG_PAINTTYPE_URI;
517 url = toCSSURIValue(value)->value(); 517 url = toCSSURIValue(value)->value();
518 } else if (value->isPrimitiveValue() && toCSSPrimitiveValue(value)->getValue ID() == CSSValueNone) {
519 paintType = url.isEmpty() ? SVG_PAINTTYPE_NONE : SVG_PAINTTYPE_URI_NONE;
520 } else if (value->isPrimitiveValue() && toCSSPrimitiveValue(value)->getValue ID() == CSSValueCurrentcolor) {
521 color = state.style()->color();
522 paintType = url.isEmpty() ? SVG_PAINTTYPE_CURRENTCOLOR : SVG_PAINTTYPE_U RI_CURRENTCOLOR;
518 } else { 523 } else {
519 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 524 color = StyleBuilderConverter::convertColor(state, *value);
520 if (primitiveValue->getValueID() == CSSValueNone) { 525 paintType = url.isEmpty() ? SVG_PAINTTYPE_RGBCOLOR : SVG_PAINTTYPE_URI_R GBCOLOR;
521 paintType = url.isEmpty() ? SVG_PAINTTYPE_NONE : SVG_PAINTTYPE_URI_N ONE;
522 } else if (primitiveValue->getValueID() == CSSValueCurrentcolor) {
523 color = state.style()->color();
524 paintType = url.isEmpty() ? SVG_PAINTTYPE_CURRENTCOLOR : SVG_PAINTTY PE_URI_CURRENTCOLOR;
525 } else {
526 color = StyleBuilderConverter::convertColor(state, *primitiveValue);
527 paintType = url.isEmpty() ? SVG_PAINTTYPE_RGBCOLOR : SVG_PAINTTYPE_U RI_RGBCOLOR;
528 }
529 } 526 }
530 {{set_value(property)}}(paintType, color, url, 527 {{set_value(property)}}(paintType, color, url,
531 state.applyPropertyToRegularStyle(), 528 state.applyPropertyToRegularStyle(),
532 state.applyPropertyToVisitedLinkStyle()); 529 state.applyPropertyToVisitedLinkStyle());
533 } 530 }
534 {% endmacro %} 531 {% endmacro %}
535 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} 532 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}}
536 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} 533 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}}
537 } // namespace blink 534 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/animation/ColorInterpolationType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698