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 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 {{set_value(property)}}( | 606 {{set_value(property)}}( |
607 svgParentStyle->{{paint_type|lower_first}}Type(), | 607 svgParentStyle->{{paint_type|lower_first}}Type(), |
608 svgParentStyle->{{paint_type|lower_first}}Color(), | 608 svgParentStyle->{{paint_type|lower_first}}Color(), |
609 svgParentStyle->{{paint_type|lower_first}}Uri(), | 609 svgParentStyle->{{paint_type|lower_first}}Uri(), |
610 state.applyPropertyToRegularStyle(), | 610 state.applyPropertyToRegularStyle(), |
611 state.applyPropertyToVisitedLinkStyle()); | 611 state.applyPropertyToVisitedLinkStyle()); |
612 } | 612 } |
613 | 613 |
614 {{declare_value_function(property_id)}} | 614 {{declare_value_function(property_id)}} |
615 { | 615 { |
616 if (value->isSVGPaint()) { | 616 String url; |
617 SVGPaint* svgPaint = toSVGPaint(value); | 617 if (value->isValueList()) { |
| 618 CSSValueList* list = toCSSValueList(value); |
| 619 ASSERT(list->length() > 1); |
618 | 620 |
619 Color color; | 621 if (!list->item(0)->isPrimitiveValue()) |
620 if (svgPaint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR | 622 return; |
621 || svgPaint->paintType() == SVGPaint::SVG_PAINTTYPE_URI_CURRENTC
OLOR) | |
622 color = state.style()->color(); | |
623 else | |
624 color = svgPaint->color(); | |
625 | 623 |
626 {{set_value(property)}}(svgPaint->paintType(), | 624 CSSPrimitiveValue* pValue = toCSSPrimitiveValue(list->item(0)); |
627 color, | 625 if (!pValue->isURI()) |
628 svgPaint->uri(), | 626 return; |
| 627 |
| 628 url = pValue->getStringValue(); |
| 629 value = list->item(1); |
| 630 } |
| 631 if (value->isPrimitiveValue()) { |
| 632 CSSPrimitiveValue* pValue = toCSSPrimitiveValue(value); |
| 633 Color c; |
| 634 SVGPaintType ptype = SVG_PAINTTYPE_RGBCOLOR; |
| 635 if (pValue->isRGBColor()) { |
| 636 c = pValue->getRGBA32Value(); |
| 637 ptype = url.isEmpty() ? SVG_PAINTTYPE_RGBCOLOR : SVG_PAINTTYPE_URI_R
GBCOLOR; |
| 638 } else if (pValue->getValueID() == CSSValueCurrentcolor) { |
| 639 c = state.style()->color(); |
| 640 ptype = url.isEmpty() ? SVG_PAINTTYPE_CURRENTCOLOR : SVG_PAINTTYPE_U
RI_CURRENTCOLOR; |
| 641 } else if (pValue->getValueID() == CSSValueNone) { |
| 642 ptype = url.isEmpty() ? SVG_PAINTTYPE_NONE : SVG_PAINTTYPE_URI_NONE; |
| 643 } else if (pValue->isURI()) { |
| 644 ptype = SVG_PAINTTYPE_URI; |
| 645 url = pValue->getStringValue(); |
| 646 } else { |
| 647 return; |
| 648 } |
| 649 {{set_value(property)}}(ptype, c, url, |
629 state.applyPropertyToRegularStyle(), | 650 state.applyPropertyToRegularStyle(), |
630 state.applyPropertyToVisitedLinkStyle()); | 651 state.applyPropertyToVisitedLinkStyle()); |
631 } | 652 } |
632 } | 653 } |
633 {% endmacro %} | 654 {% endmacro %} |
634 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} | 655 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} |
635 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} | 656 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} |
636 } // namespace WebCore | 657 } // namespace WebCore |
OLD | NEW |