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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 {{set_value(property)}}( | 589 {{set_value(property)}}( |
590 svgParentStyle->{{paint_type|lower_first}}Type(), | 590 svgParentStyle->{{paint_type|lower_first}}Type(), |
591 svgParentStyle->{{paint_type|lower_first}}Color(), | 591 svgParentStyle->{{paint_type|lower_first}}Color(), |
592 svgParentStyle->{{paint_type|lower_first}}Uri(), | 592 svgParentStyle->{{paint_type|lower_first}}Uri(), |
593 state.applyPropertyToRegularStyle(), | 593 state.applyPropertyToRegularStyle(), |
594 state.applyPropertyToVisitedLinkStyle()); | 594 state.applyPropertyToVisitedLinkStyle()); |
595 } | 595 } |
596 | 596 |
597 {{declare_value_function(property_id)}} | 597 {{declare_value_function(property_id)}} |
598 { | 598 { |
599 if (value->isSVGPaint()) { | 599 String url; |
600 SVGPaint* svgPaint = toSVGPaint(value); | 600 if (value->isValueList()) { |
| 601 CSSValueList* list = toCSSValueList(value); |
| 602 if (list->length() < 2) |
| 603 return; |
601 | 604 |
602 Color color; | 605 if (!list->item(0)->isPrimitiveValue()) |
603 if (svgPaint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR | 606 return; |
604 || svgPaint->paintType() == SVGPaint::SVG_PAINTTYPE_URI_CURRENTC
OLOR) | |
605 color = state.style()->color(); | |
606 else | |
607 color = svgPaint->color(); | |
608 | 607 |
609 {{set_value(property)}}(svgPaint->paintType(), | 608 CSSPrimitiveValue* pValue = toCSSPrimitiveValue(list->item(0)); |
610 color, | 609 if (!pValue->isURI()) |
611 svgPaint->uri(), | 610 return; |
| 611 |
| 612 url = pValue->getStringValue(); |
| 613 value = list->item(1); |
| 614 } |
| 615 if (value->isPrimitiveValue()) { |
| 616 CSSPrimitiveValue* pValue = toCSSPrimitiveValue(value); |
| 617 Color c; |
| 618 SVGPaint::SVGPaintType ptype = SVGPaint::SVG_PAINTTYPE_RGBCOLOR; |
| 619 if (pValue->isRGBColor()) { |
| 620 c = pValue->getRGBA32Value(); |
| 621 ptype = url.isEmpty() ? SVGPaint::SVG_PAINTTYPE_RGBCOLOR : SVGPaint:
:SVG_PAINTTYPE_URI_RGBCOLOR; |
| 622 } else if (pValue->getValueID() == CSSValueCurrentcolor) { |
| 623 c = state.style()->color(); |
| 624 ptype = url.isEmpty() ? SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR : SVGPa
int::SVG_PAINTTYPE_URI_CURRENTCOLOR; |
| 625 } else if (pValue->getValueID() == CSSValueNone) |
| 626 ptype = url.isEmpty() ? SVGPaint::SVG_PAINTTYPE_NONE : SVGPaint::SVG
_PAINTTYPE_URI_NONE; |
| 627 else if (pValue->isURI()) { |
| 628 ptype = SVGPaint::SVG_PAINTTYPE_URI; |
| 629 url = pValue->getStringValue(); |
| 630 } |
| 631 {{set_value(property)}}(ptype, c, url, |
612 state.applyPropertyToRegularStyle(), | 632 state.applyPropertyToRegularStyle(), |
613 state.applyPropertyToVisitedLinkStyle()); | 633 state.applyPropertyToVisitedLinkStyle()); |
614 } | 634 } |
615 } | 635 } |
616 {% endmacro %} | 636 {% endmacro %} |
617 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} | 637 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} |
618 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} | 638 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} |
619 } // namespace WebCore | 639 } // namespace WebCore |
OLD | NEW |