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