| OLD | NEW |
| 1 {% from 'macros.tmpl' import license %} | 1 {% from 'macros.tmpl' import license %} |
| 2 {{license()}} | 2 {{license()}} |
| 3 | 3 |
| 4 #include "core/css/resolver/StyleBuilder.h" | 4 #include "core/css/resolver/StyleBuilder.h" |
| 5 | 5 |
| 6 #include "StyleBuilderFunctions.h" | 6 #include "StyleBuilderFunctions.h" |
| 7 #include "core/css/CSSProperty.h" | 7 #include "core/css/CSSProperty.h" |
| 8 #include "core/css/resolver/StyleResolverState.h" | 8 #include "core/css/resolver/StyleResolverState.h" |
| 9 | 9 |
| 10 // FIXME: currently we're just generating a switch statement, but we should | 10 // FIXME: currently we're just generating a switch statement, but we should |
| 11 // test other variations for performance once we have more properties here. | 11 // test other variations for performance once we have more properties here. |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 void StyleBuilder::applyProperty(CSSPropertyID property, | 15 void StyleBuilder::ApplyProperty(CSSPropertyID property, |
| 16 StyleResolverState& state, | 16 StyleResolverState& state, |
| 17 const CSSValue& value, | 17 const CSSValue& value, |
| 18 bool isInitial, | 18 bool isInitial, |
| 19 bool isInherit) { | 19 bool isInherit) { |
| 20 switch(property) { | 20 switch(property) { |
| 21 {% for property_id, property in properties.items() | 21 {% for property_id, property in properties.items() |
| 22 if property.should_declare_functions or property.use_handlers_for %} | 22 if property.should_declare_functions or property.use_handlers_for %} |
| 23 {% set used_property = properties[property.use_handlers_for] or property %} | 23 {% set used_property = properties[property.use_handlers_for] or property %} |
| 24 {% set used_property_id = used_property.property_id %} | 24 {% set used_property_id = used_property.property_id %} |
| 25 case {{property_id}}: | 25 case {{property_id}}: |
| 26 if (isInitial) | 26 if (isInitial) |
| 27 StyleBuilderFunctions::applyInitial{{used_property_id}}(state); | 27 StyleBuilderFunctions::applyInitial{{used_property_id}}(state); |
| 28 else if (isInherit) | 28 else if (isInherit) |
| 29 StyleBuilderFunctions::applyInherit{{used_property_id}}(state); | 29 StyleBuilderFunctions::applyInherit{{used_property_id}}(state); |
| 30 else | 30 else |
| 31 StyleBuilderFunctions::applyValue{{used_property_id}}(state, value); | 31 StyleBuilderFunctions::applyValue{{used_property_id}}(state, value); |
| 32 return; | 32 return; |
| 33 | 33 |
| 34 {% endfor %} | 34 {% endfor %} |
| 35 case CSSPropertyVariable: | 35 case CSSPropertyVariable: |
| 36 ASSERT(!isInitial && !isInherit); | 36 ASSERT(!isInitial && !isInherit); |
| 37 StyleBuilderFunctions::applyValueCSSPropertyVariable(state, value); | 37 StyleBuilderFunctions::applyValueCSSPropertyVariable(state, value); |
| 38 return; | 38 return; |
| 39 {% for property_id, property in properties.items() if property.direction_awa
re %} | 39 {% for property_id, property in properties.items() if property.direction_awa
re %} |
| 40 case {{property_id}}: | 40 case {{property_id}}: |
| 41 {% endfor %} | 41 {% endfor %} |
| 42 { | 42 { |
| 43 CSSPropertyID resolvedProperty = CSSProperty::resolveDirectionAwarePropert
y(property, state.style()->direction(), state.style()->getWritingMode()); | 43 CSSPropertyID resolvedProperty = CSSProperty::ResolveDirectionAwarePropert
y(property, state.Style()->Direction(), state.Style()->GetWritingMode()); |
| 44 ASSERT(resolvedProperty != property); | 44 ASSERT(resolvedProperty != property); |
| 45 applyProperty(resolvedProperty, state, value); | 45 ApplyProperty(resolvedProperty, state, value); |
| 46 return; | 46 return; |
| 47 } | 47 } |
| 48 {% for property_id, property in properties.items() if property.builder_skip
%} | 48 {% for property_id, property in properties.items() if property.builder_skip
%} |
| 49 case {{property_id}}: | 49 case {{property_id}}: |
| 50 {% endfor %} | 50 {% endfor %} |
| 51 return; | 51 return; |
| 52 default: | 52 default: |
| 53 ASSERT_NOT_REACHED(); | 53 ASSERT_NOT_REACHED(); |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| 57 } // namespace blink | 57 } // namespace blink |
| OLD | NEW |