| 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 "StyleBuilderFunctions.h" | 9 #include "StyleBuilderFunctions.h" |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 state.style()->{{property.setter}} | 36 state.style()->{{property.setter}} |
| 37 {%- endif %} | 37 {%- endif %} |
| 38 {% endmacro %} | 38 {% endmacro %} |
| 39 {% macro convert_and_set_value(property) %} | 39 {% macro convert_and_set_value(property) %} |
| 40 {% if property.converter %} | 40 {% if property.converter %} |
| 41 {{set_value(property)}}(StyleBuilderConverter::{{property.converter}}(state, val
ue)); | 41 {{set_value(property)}}(StyleBuilderConverter::{{property.converter}}(state, val
ue)); |
| 42 {%- else %} | 42 {%- else %} |
| 43 {{set_value(property)}}(toCSSPrimitiveValue(value).convertTo<{{property.type_nam
e}}>()); | 43 {{set_value(property)}}(toCSSPrimitiveValue(value).convertTo<{{property.type_nam
e}}>()); |
| 44 {%- endif %} | 44 {%- endif %} |
| 45 {% endmacro %} | 45 {% endmacro %} |
| 46 {% macro set_is_inherited(property) %} |
| 47 state.style()->{{property.is_inherited_setter}} |
| 48 {% endmacro %} |
| 46 | 49 |
| 47 namespace blink { | 50 namespace blink { |
| 48 | 51 |
| 49 {% for property_id, property in properties.items() if property.should_declare_fu
nctions %} | 52 {% for property_id, property in properties.items() if property.should_declare_fu
nctions %} |
| 50 {% set apply_type = property.apply_type %} | 53 {% set apply_type = property.apply_type %} |
| 51 {% if not property.custom_initial %} | 54 {% if not property.custom_initial %} |
| 52 {{declare_initial_function(property_id)}} | 55 {{declare_initial_function(property_id)}} |
| 53 { | 56 { |
| 54 {% if property.svg %} | 57 {% if property.svg %} |
| 55 {{set_value(property)}}(SVGComputedStyle::{{property.initial}}()); | 58 {{set_value(property)}}(SVGComputedStyle::{{property.initial}}()); |
| 56 {% elif property.font %} | 59 {% elif property.font %} |
| 57 {{set_value(property)}}(FontBuilder::{{property.initial}}()); | 60 {{set_value(property)}}(FontBuilder::{{property.initial}}()); |
| 58 {% else %} | 61 {% else %} |
| 59 {{set_value(property)}}(ComputedStyle::{{property.initial}}()); | 62 {{set_value(property)}}(ComputedStyle::{{property.initial}}()); |
| 60 {% endif %} | 63 {% endif %} |
| 64 {% if property.independent %} |
| 65 {{set_is_inherited(property)}}(true); |
| 66 {% endif %} |
| 61 } | 67 } |
| 62 | 68 |
| 63 {% endif %} | 69 {% endif %} |
| 64 {% if not property.custom_inherit %} | 70 {% if not property.custom_inherit %} |
| 65 {{declare_inherit_function(property_id)}} | 71 {{declare_inherit_function(property_id)}} |
| 66 { | 72 { |
| 67 {% if property.svg %} | 73 {% if property.svg %} |
| 68 {{set_value(property)}}(state.parentStyle()->svgStyle().{{property.getter}}(
)); | 74 {{set_value(property)}}(state.parentStyle()->svgStyle().{{property.getter}}(
)); |
| 69 {% elif property.font %} | 75 {% elif property.font %} |
| 70 {{set_value(property)}}(state.parentFontDescription().{{property.getter}}())
; | 76 {{set_value(property)}}(state.parentFontDescription().{{property.getter}}())
; |
| 71 {% else %} | 77 {% else %} |
| 72 {{set_value(property)}}(state.parentStyle()->{{property.getter}}()); | 78 {{set_value(property)}}(state.parentStyle()->{{property.getter}}()); |
| 73 {% endif %} | 79 {% endif %} |
| 80 {% if property.independent %} |
| 81 {{set_is_inherited(property)}}(false); |
| 82 {% endif %} |
| 74 } | 83 } |
| 75 | 84 |
| 76 {% endif %} | 85 {% endif %} |
| 77 {% if not property.custom_value %} | 86 {% if not property.custom_value %} |
| 78 {{declare_value_function(property_id)}} | 87 {{declare_value_function(property_id)}} |
| 79 { | 88 { |
| 80 {{convert_and_set_value(property)}} | 89 {{convert_and_set_value(property)}} |
| 90 {% if property.independent %} |
| 91 {{set_is_inherited(property)}}(false); |
| 92 {% endif %} |
| 81 } | 93 } |
| 82 | 94 |
| 83 {% endif %} | 95 {% endif %} |
| 84 {% endfor %} | 96 {% endfor %} |
| 85 | 97 |
| 86 {% macro apply_animation(property_id, attribute, animation) %} | 98 {% macro apply_animation(property_id, attribute, animation) %} |
| 87 {% set vector = attribute|lower_first + "List()" %} | 99 {% set vector = attribute|lower_first + "List()" %} |
| 88 {{declare_initial_function(property_id)}} | 100 {{declare_initial_function(property_id)}} |
| 89 { | 101 { |
| 90 CSS{{animation}}Data& data = state.style()->access{{animation}}s(); | 102 CSS{{animation}}Data& data = state.style()->access{{animation}}s(); |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 paintType = url.isEmpty() ? SVG_PAINTTYPE_RGBCOLOR : SVG_PAINTTYPE_URI_R
GBCOLOR; | 545 paintType = url.isEmpty() ? SVG_PAINTTYPE_RGBCOLOR : SVG_PAINTTYPE_URI_R
GBCOLOR; |
| 534 } | 546 } |
| 535 {{set_value(property)}}(paintType, color, url, | 547 {{set_value(property)}}(paintType, color, url, |
| 536 state.applyPropertyToRegularStyle(), | 548 state.applyPropertyToRegularStyle(), |
| 537 state.applyPropertyToVisitedLinkStyle()); | 549 state.applyPropertyToVisitedLinkStyle()); |
| 538 } | 550 } |
| 539 {% endmacro %} | 551 {% endmacro %} |
| 540 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} | 552 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} |
| 541 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} | 553 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} |
| 542 } // namespace blink | 554 } // namespace blink |
| OLD | NEW |