| 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 20 matching lines...) Expand all Loading... |
| 31 state.fontBuilder().{{property.setter}} | 31 state.fontBuilder().{{property.setter}} |
| 32 {%- else %} | 32 {%- else %} |
| 33 state.style()->{{property.setter}} | 33 state.style()->{{property.setter}} |
| 34 {%- endif %} | 34 {%- endif %} |
| 35 {% endmacro %} | 35 {% endmacro %} |
| 36 | 36 |
| 37 namespace WebCore { | 37 namespace WebCore { |
| 38 | 38 |
| 39 {% for property_id, property in properties.items() if property.should_declare_fu
nctions %} | 39 {% for property_id, property in properties.items() if property.should_declare_fu
nctions %} |
| 40 {% set apply_type = property.apply_type %} | 40 {% set apply_type = property.apply_type %} |
| 41 {% if not property.custom_initial %} | 41 {% if not property.sb_custom_initial %} |
| 42 {{declare_initial_function(property_id)}} | 42 {{declare_initial_function(property_id)}} |
| 43 { | 43 { |
| 44 {% if property.svg %} | 44 {% if property.svg %} |
| 45 {{set_value(property)}}(SVGRenderStyle::{{property.initial}}()); | 45 {{set_value(property)}}(SVGRenderStyle::{{property.initial}}()); |
| 46 {% elif property.font %} | 46 {% elif property.font %} |
| 47 {{set_value(property)}}(FontBuilder::{{property.initial}}()); | 47 {{set_value(property)}}(FontBuilder::{{property.initial}}()); |
| 48 {% else %} | 48 {% else %} |
| 49 {{set_value(property)}}(RenderStyle::{{property.initial}}()); | 49 {{set_value(property)}}(RenderStyle::{{property.initial}}()); |
| 50 {% endif %} | 50 {% endif %} |
| 51 } | 51 } |
| 52 | 52 |
| 53 {% endif %} | 53 {% endif %} |
| 54 {% if not property.custom_inherit %} | 54 {% if not property.sb_custom_inherit %} |
| 55 {{declare_inherit_function(property_id)}} | 55 {{declare_inherit_function(property_id)}} |
| 56 { | 56 { |
| 57 {% if property.svg %} | 57 {% if property.svg %} |
| 58 {{set_value(property)}}(state.parentStyle()->svgStyle().{{property.getter}}(
)); | 58 {{set_value(property)}}(state.parentStyle()->svgStyle().{{property.getter}}(
)); |
| 59 {% elif property.font %} | 59 {% elif property.font %} |
| 60 {{set_value(property)}}(state.parentFontDescription().{{property.getter}}())
; | 60 {{set_value(property)}}(state.parentFontDescription().{{property.getter}}())
; |
| 61 {% else %} | 61 {% else %} |
| 62 {{set_value(property)}}(state.parentStyle()->{{property.getter}}()); | 62 {{set_value(property)}}(state.parentStyle()->{{property.getter}}()); |
| 63 {% endif %} | 63 {% endif %} |
| 64 } | 64 } |
| 65 | 65 |
| 66 {% endif %} | 66 {% endif %} |
| 67 {% if not property.custom_value %} | 67 {% if not property.sb_custom_value %} |
| 68 {{declare_value_function(property_id)}} | 68 {{declare_value_function(property_id)}} |
| 69 { | 69 { |
| 70 {% if property.converter %} | 70 {% if property.sb_converter %} |
| 71 {{set_value(property)}}(StyleBuilderConverter::{{property.converter}}(state,
value)); | 71 {{set_value(property)}}(StyleBuilderConverter::{{property.sb_converter}}(sta
te, value)); |
| 72 {% else %} | 72 {% else %} |
| 73 {{set_value(property)}}(static_cast<{{property.type_name}}>(*toCSSPrimitiveV
alue(value))); | 73 {{set_value(property)}}(static_cast<{{property.type_name}}>(*toCSSPrimitiveV
alue(value))); |
| 74 {% endif %} | 74 {% endif %} |
| 75 } | 75 } |
| 76 | 76 |
| 77 {% endif %} | 77 {% endif %} |
| 78 {% endfor %} | 78 {% endfor %} |
| 79 | 79 |
| 80 {% macro apply_animation(property_id, attribute, animation) %} | 80 {% macro apply_animation(property_id, attribute, animation) %} |
| 81 {% set vector = attribute|lower_first + "List()" %} | 81 {% set vector = attribute|lower_first + "List()" %} |
| (...skipping 29 matching lines...) Expand all Loading... |
| 111 {{apply_animation('CSSPropertyWebkitAnimationName', 'Name', 'Animation')}} | 111 {{apply_animation('CSSPropertyWebkitAnimationName', 'Name', 'Animation')}} |
| 112 {{apply_animation('CSSPropertyWebkitAnimationPlayState', 'PlayState', 'Animation
')}} | 112 {{apply_animation('CSSPropertyWebkitAnimationPlayState', 'PlayState', 'Animation
')}} |
| 113 {{apply_animation('CSSPropertyWebkitAnimationTimingFunction', 'TimingFunction',
'Animation')}} | 113 {{apply_animation('CSSPropertyWebkitAnimationTimingFunction', 'TimingFunction',
'Animation')}} |
| 114 {{apply_animation('CSSPropertyWebkitTransitionDelay', 'Delay', 'Transition')}} | 114 {{apply_animation('CSSPropertyWebkitTransitionDelay', 'Delay', 'Transition')}} |
| 115 {{apply_animation('CSSPropertyWebkitTransitionDuration', 'Duration', 'Transition
')}} | 115 {{apply_animation('CSSPropertyWebkitTransitionDuration', 'Duration', 'Transition
')}} |
| 116 {{apply_animation('CSSPropertyWebkitTransitionProperty', 'Property', 'Transition
')}} | 116 {{apply_animation('CSSPropertyWebkitTransitionProperty', 'Property', 'Transition
')}} |
| 117 {{apply_animation('CSSPropertyWebkitTransitionTimingFunction', 'TimingFunction',
'Transition')}} | 117 {{apply_animation('CSSPropertyWebkitTransitionTimingFunction', 'TimingFunction',
'Transition')}} |
| 118 | 118 |
| 119 {% macro apply_auto(property_id, auto_getter=none, auto_setter=none, auto_identi
ty='CSSValueAuto', compute_length=false) %} | 119 {% macro apply_auto(property_id, auto_getter=none, auto_setter=none, auto_identi
ty='CSSValueAuto', compute_length=false) %} |
| 120 {% set property = properties[property_id] %} | 120 {% set property = properties[property_id] %} |
| 121 {% set auto_getter = auto_getter or 'hasAuto' + property.camel_case_name %} | 121 {% set auto_getter = auto_getter or 'hasAuto' + property.name_for_methods %} |
| 122 {% set auto_setter = auto_setter or 'setHasAuto' + property.camel_case_name %} | 122 {% set auto_setter = auto_setter or 'setHasAuto' + property.name_for_methods %} |
| 123 {{declare_initial_function(property_id)}} | 123 {{declare_initial_function(property_id)}} |
| 124 { | 124 { |
| 125 state.style()->{{auto_setter}}(); | 125 state.style()->{{auto_setter}}(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 {{declare_inherit_function(property_id)}} | 128 {{declare_inherit_function(property_id)}} |
| 129 { | 129 { |
| 130 if (state.parentStyle()->{{auto_getter}}()) | 130 if (state.parentStyle()->{{auto_getter}}()) |
| 131 state.style()->{{auto_setter}}(); | 131 state.style()->{{auto_setter}}(); |
| 132 else | 132 else |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 { | 274 { |
| 275 {% set property = properties[property_id] %} | 275 {% set property = properties[property_id] %} |
| 276 {{set_value(property)}}(state.styleImage({{property_id}}, value)); | 276 {{set_value(property)}}(state.styleImage({{property_id}}, value)); |
| 277 } | 277 } |
| 278 {% endmacro %} | 278 {% endmacro %} |
| 279 {{apply_value_border_image_source('CSSPropertyBorderImageSource')}} | 279 {{apply_value_border_image_source('CSSPropertyBorderImageSource')}} |
| 280 {{apply_value_border_image_source('CSSPropertyWebkitMaskBoxImageSource')}} | 280 {{apply_value_border_image_source('CSSPropertyWebkitMaskBoxImageSource')}} |
| 281 | 281 |
| 282 {% macro apply_color(property_id, initial_color='StyleColor::currentColor') %} | 282 {% macro apply_color(property_id, initial_color='StyleColor::currentColor') %} |
| 283 {% set property = properties[property_id] %} | 283 {% set property = properties[property_id] %} |
| 284 {% set visited_link_setter = 'setVisitedLink' + property.camel_case_name %} | 284 {% set visited_link_setter = 'setVisitedLink' + property.name_for_methods %} |
| 285 {{declare_initial_function(property_id)}} | 285 {{declare_initial_function(property_id)}} |
| 286 { | 286 { |
| 287 StyleColor color = {{initial_color}}(); | 287 StyleColor color = {{initial_color}}(); |
| 288 if (state.applyPropertyToRegularStyle()) | 288 if (state.applyPropertyToRegularStyle()) |
| 289 {{set_value(property)}}(color); | 289 {{set_value(property)}}(color); |
| 290 if (state.applyPropertyToVisitedLinkStyle()) | 290 if (state.applyPropertyToVisitedLinkStyle()) |
| 291 state.style()->{{visited_link_setter}}(color); | 291 state.style()->{{visited_link_setter}}(color); |
| 292 } | 292 } |
| 293 | 293 |
| 294 {{declare_inherit_function(property_id)}} | 294 {{declare_inherit_function(property_id)}} |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 } | 636 } |
| 637 {{set_value(property)}}(ptype, c, url, | 637 {{set_value(property)}}(ptype, c, url, |
| 638 state.applyPropertyToRegularStyle(), | 638 state.applyPropertyToRegularStyle(), |
| 639 state.applyPropertyToVisitedLinkStyle()); | 639 state.applyPropertyToVisitedLinkStyle()); |
| 640 } | 640 } |
| 641 } | 641 } |
| 642 {% endmacro %} | 642 {% endmacro %} |
| 643 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} | 643 {{apply_svg_paint('CSSPropertyFill', 'FillPaint')}} |
| 644 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} | 644 {{apply_svg_paint('CSSPropertyStroke', 'StrokePaint')}} |
| 645 } // namespace WebCore | 645 } // namespace WebCore |
| OLD | NEW |