| 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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 {{declare_value_function(property_id)}} | 513 {{declare_value_function(property_id)}} |
| 514 { | 514 { |
| 515 String url; | 515 String url; |
| 516 if (value->isValueList()) { | 516 if (value->isValueList()) { |
| 517 CSSValueList* list = toCSSValueList(value); | 517 CSSValueList* list = toCSSValueList(value); |
| 518 ASSERT(list->length() > 1); | 518 ASSERT(list->length() > 1); |
| 519 | 519 |
| 520 if (!list->item(0)->isPrimitiveValue()) | 520 if (!list->item(0)->isPrimitiveValue()) |
| 521 return; | 521 return; |
| 522 | 522 |
| 523 CSSPrimitiveValue* pValue = toCSSPrimitiveValue(list->item(0)); | 523 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(list->item(0)); |
| 524 if (!pValue->isURI()) | 524 if (!primitiveValue->isURI()) |
| 525 return; | 525 return; |
| 526 | 526 |
| 527 url = pValue->getStringValue(); | 527 url = primitiveValue->getStringValue(); |
| 528 value = list->item(1); | 528 value = list->item(1); |
| 529 } | 529 } |
| 530 if (value->isPrimitiveValue()) { | 530 if (value->isPrimitiveValue()) { |
| 531 CSSPrimitiveValue* pValue = toCSSPrimitiveValue(value); | 531 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
| 532 Color c; | 532 Color color; |
| 533 SVGPaintType ptype = SVG_PAINTTYPE_RGBCOLOR; | 533 SVGPaintType paintType = SVG_PAINTTYPE_RGBCOLOR; |
| 534 if (pValue->isRGBColor()) { | 534 if (primitiveValue->getValueID() == CSSValueNone) { |
| 535 c = pValue->getRGBA32Value(); | 535 paintType = url.isEmpty() ? SVG_PAINTTYPE_NONE : SVG_PAINTTYPE_URI_N
ONE; |
| 536 ptype = url.isEmpty() ? SVG_PAINTTYPE_RGBCOLOR : SVG_PAINTTYPE_URI_R
GBCOLOR; | 536 } else if (primitiveValue->isURI()) { |
| 537 } else if (pValue->getValueID() == CSSValueCurrentcolor) { | 537 paintType = SVG_PAINTTYPE_URI; |
| 538 c = state.style()->color(); | 538 url = primitiveValue->getStringValue(); |
| 539 ptype = url.isEmpty() ? SVG_PAINTTYPE_CURRENTCOLOR : SVG_PAINTTYPE_U
RI_CURRENTCOLOR; | 539 } else if (primitiveValue->getValueID() == CSSValueCurrentcolor) { |
| 540 } else if (pValue->getValueID() == CSSValueNone) { | 540 color = state.style()->color(); |
| 541 ptype = url.isEmpty() ? SVG_PAINTTYPE_NONE : SVG_PAINTTYPE_URI_NONE; | 541 paintType = url.isEmpty() ? SVG_PAINTTYPE_CURRENTCOLOR : SVG_PAINTTY
PE_URI_CURRENTCOLOR; |
| 542 } else if (pValue->isURI()) { | |
| 543 ptype = SVG_PAINTTYPE_URI; | |
| 544 url = pValue->getStringValue(); | |
| 545 } else { | 542 } else { |
| 546 return; | 543 color = StyleBuilderConverter::convertColor(state, primitiveValue); |
| 544 paintType = url.isEmpty() ? SVG_PAINTTYPE_RGBCOLOR : SVG_PAINTTYPE_U
RI_RGBCOLOR; |
| 547 } | 545 } |
| 548 {{set_value(property)}}(ptype, c, url, | 546 {{set_value(property)}}(paintType, color, url, |
| 549 state.applyPropertyToRegularStyle(), | 547 state.applyPropertyToRegularStyle(), |
| 550 state.applyPropertyToVisitedLinkStyle()); | 548 state.applyPropertyToVisitedLinkStyle()); |
| 551 } | 549 } |
| 552 } | 550 } |
| 553 {% endmacro %} | 551 {% endmacro %} |
| 554 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} | 552 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} |
| 555 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} | 553 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} |
| 556 } // namespace blink | 554 } // namespace blink |
| OLD | NEW |