Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / build / scripts / templates / StyleBuilder.cpp.tmpl
1 {% from 'macros.tmpl' import license %}
2 {{license()}}
3
4 #include "config.h"
5 #include "core/css/resolver/StyleBuilder.h"
6
7 #include "StyleBuilderFunctions.h"
8 #include "core/css/resolver/StyleResolverState.h"
9
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.
12
13 namespace WebCore {
14
15 bool StyleBuilder::applyProperty(CSSPropertyID property, StyleResolverState& state, CSSValue* value, bool isInitial, bool isInherit) {
16     switch(property) {
17     {% for property_id, property in properties.items() %}
18     {% set used_property = properties[property.use_handlers_for] or property %}
19     {% set used_property_id = used_property.property_id %}
20     case {{property_id}}:
21         if (isInitial)
22             StyleBuilderFunctions::applyInitial{{used_property_id}}(state);
23         else if (isInherit)
24             StyleBuilderFunctions::applyInherit{{used_property_id}}(state);
25         else
26             StyleBuilderFunctions::applyValue{{used_property_id}}(state, value);
27         return true;
28
29     {% endfor %}
30     default:
31         return false;
32     }
33 }
34
35 } // namespace WebCore