OLD | NEW |
---|---|
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 Loading... | |
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) { | |
alancutter (OOO until 2018)
2015/10/07 06:34:25
The old code wasn't checking isPrimitiveValue() so
sashab
2015/10/12 23:04:50
Unfortunately I have to write it this way, otherwi
| |
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 |
OLD | NEW |