| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 {% endif %} | 66 {% endif %} |
| 67 {% if not property.custom_value %} | 67 {% if not property.custom_value %} |
| 68 {{declare_value_function(property_id)}} | 68 {{declare_value_function(property_id)}} |
| 69 { | 69 { |
| 70 {{convert_and_set_value(property)}} | 70 {{convert_and_set_value(property)}} |
| 71 } | 71 } |
| 72 | 72 |
| 73 {% endif %} | 73 {% endif %} |
| 74 {% endfor %} | 74 {% endfor %} |
| 75 | 75 |
| 76 {% macro apply_animation(property_id, attribute, animation) %} | |
| 77 {% set vector = attribute|lower_first + "List()" %} | |
| 78 {{declare_initial_function(property_id)}} | |
| 79 { | |
| 80 CSS{{animation}}Data& data = state.style()->access{{animation}}s(); | |
| 81 data.{{vector}}.clear(); | |
| 82 data.{{vector}}.append(CSS{{animation}}Data::initial{{attribute}}()); | |
| 83 } | |
| 84 | |
| 85 {{declare_inherit_function(property_id)}} | |
| 86 { | |
| 87 const CSS{{animation}}Data* parentData = state.parentStyle()->{{animation|lo
wer}}s(); | |
| 88 if (!parentData) | |
| 89 applyInitial{{property_id}}(state); | |
| 90 else | |
| 91 state.style()->access{{animation}}s().{{vector}} = parentData->{{vector}
}; | |
| 92 } | |
| 93 | |
| 94 {{declare_value_function(property_id)}} | |
| 95 { | |
| 96 CSS{{animation}}Data& data = state.style()->access{{animation}}s(); | |
| 97 data.{{vector}}.clear(); | |
| 98 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) | |
| 99 data.{{vector}}.append(state.styleMap().mapAnimation{{attribute}}(i.valu
e())); | |
| 100 } | |
| 101 {% endmacro %} | |
| 102 {{apply_animation('CSSPropertyAnimationDelay', 'Delay', 'Animation')}} | |
| 103 {{apply_animation('CSSPropertyAnimationDirection', 'Direction', 'Animation')}} | |
| 104 {{apply_animation('CSSPropertyAnimationDuration', 'Duration', 'Animation')}} | |
| 105 {{apply_animation('CSSPropertyAnimationFillMode', 'FillMode', 'Animation')}} | |
| 106 {{apply_animation('CSSPropertyAnimationIterationCount', 'IterationCount', 'Anima
tion')}} | |
| 107 {{apply_animation('CSSPropertyAnimationName', 'Name', 'Animation')}} | |
| 108 {{apply_animation('CSSPropertyAnimationPlayState', 'PlayState', 'Animation')}} | |
| 109 {{apply_animation('CSSPropertyAnimationTimingFunction', 'TimingFunction', 'Anima
tion')}} | |
| 110 {{apply_animation('CSSPropertyTransitionDelay', 'Delay', 'Transition')}} | |
| 111 {{apply_animation('CSSPropertyTransitionDuration', 'Duration', 'Transition')}} | |
| 112 {{apply_animation('CSSPropertyTransitionProperty', 'Property', 'Transition')}} | |
| 113 {{apply_animation('CSSPropertyTransitionTimingFunction', 'TimingFunction', 'Tran
sition')}} | |
| 114 | |
| 115 {% macro apply_auto(property_id, auto_getter=none, auto_setter=none, auto_identi
ty='CSSValueAuto') %} | 76 {% macro apply_auto(property_id, auto_getter=none, auto_setter=none, auto_identi
ty='CSSValueAuto') %} |
| 116 {% set property = properties[property_id] %} | 77 {% set property = properties[property_id] %} |
| 117 {% set auto_getter = auto_getter or 'hasAuto' + property.name_for_methods %} | 78 {% set auto_getter = auto_getter or 'hasAuto' + property.name_for_methods %} |
| 118 {% set auto_setter = auto_setter or 'setHasAuto' + property.name_for_methods %} | 79 {% set auto_setter = auto_setter or 'setHasAuto' + property.name_for_methods %} |
| 119 {{declare_initial_function(property_id)}} | 80 {{declare_initial_function(property_id)}} |
| 120 { | 81 { |
| 121 state.style()->{{auto_setter}}(); | 82 state.style()->{{auto_setter}}(); |
| 122 } | 83 } |
| 123 | 84 |
| 124 {{declare_inherit_function(property_id)}} | 85 {{declare_inherit_function(property_id)}} |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 state.style()->set{{alignment_type}}OverflowAlignment(*pairValue->second
()); | 400 state.style()->set{{alignment_type}}OverflowAlignment(*pairValue->second
()); |
| 440 } else { | 401 } else { |
| 441 state.style()->set{{alignment_type}}(*primitiveValue); | 402 state.style()->set{{alignment_type}}(*primitiveValue); |
| 442 } | 403 } |
| 443 } | 404 } |
| 444 {% endmacro %} | 405 {% endmacro %} |
| 445 {{apply_alignment('CSSPropertyAlignItems', 'AlignItems')}} | 406 {{apply_alignment('CSSPropertyAlignItems', 'AlignItems')}} |
| 446 {{apply_alignment('CSSPropertyAlignSelf', 'AlignSelf')}} | 407 {{apply_alignment('CSSPropertyAlignSelf', 'AlignSelf')}} |
| 447 | 408 |
| 448 } // namespace blink | 409 } // namespace blink |
| OLD | NEW |