OLD | NEW |
1 {% from 'macros.tmpl' import license, print_if %} | 1 {% from 'macros.tmpl' import license, print_if %} |
2 {{license()}} | 2 {{license()}} |
3 | 3 |
4 #ifndef ComputedStyleBase_h | 4 #ifndef ComputedStyleBase_h |
5 #define ComputedStyleBase_h | 5 #define ComputedStyleBase_h |
6 | 6 |
7 #include "core/ComputedStyleBaseConstants.h" | 7 #include "core/ComputedStyleBaseConstants.h" |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 {% for field in fields if field.storage_type_path != None %} | 9 {% for field in fields if field.type_path != None %} |
10 #include "{{field.storage_type_path}}.h" | 10 #include "{{field.type_path}}.h" |
11 {% endfor %} | 11 {% endfor %} |
12 | 12 |
13 {# Returns the default value for the field, converted to fit in the storage cont
ainer. #} | 13 {# Returns the default value for the field, converted to fit in the storage cont
ainer. #} |
14 {% macro default_value(field) -%} | 14 {% macro default_value(field) -%} |
15 {# We only support enum fields for now. #} | 15 {# We only support enum fields for now. #} |
16 static_cast<unsigned>({{field.default_value}}) | 16 static_cast<unsigned>({{field.default_value}}) |
17 {%- endmacro %} | 17 {%- endmacro %} |
18 | 18 |
19 namespace blink { | 19 namespace blink { |
20 | 20 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // Copies the values of any independent inherited properties from the parent | 95 // Copies the values of any independent inherited properties from the parent |
96 // style that are marked as inherited by this style. | 96 // style that are marked as inherited by this style. |
97 void propagateIndependentInheritedProperties( | 97 void propagateIndependentInheritedProperties( |
98 const ComputedStyleBase& parentStyle); | 98 const ComputedStyleBase& parentStyle); |
99 | 99 |
100 // Fields. | 100 // Fields. |
101 // TODO(sashab): Remove initialFoo() static methods and update callers to | 101 // TODO(sashab): Remove initialFoo() static methods and update callers to |
102 // use resetFoo(), which can be more efficient. | 102 // use resetFoo(), which can be more efficient. |
103 {% for field in fields %} | 103 {% for field in fields %} |
104 // {{field.property_name}} | 104 // {{field.property_name}} |
105 inline static {{field.storage_type}} {{field.initial_method_name}}() { return
{{field.default_value}}; } | 105 inline static {{field.type_name}} {{field.initial_method_name}}() { return {{f
ield.default_value}}; } |
106 {{field.storage_type}} {{field.getter_method_name}}() const { return static_ca
st<{{field.storage_type}}>({{field.name}}); } | 106 {{field.type_name}} {{field.getter_method_name}}() const { return static_cast<
{{field.type_name}}>({{field.name}}); } |
107 {% if field.is_nonproperty %} | 107 {% if field.is_nonproperty %} |
108 void {{field.setter_method_name}}() { {{field.name}} = static_cast<unsigned>(t
rue); } | 108 void {{field.setter_method_name}}() { {{field.name}} = static_cast<unsigned>(t
rue); } |
109 {% else %} | 109 {% else %} |
110 void {{field.setter_method_name}}({{field.storage_type}} v) { {{field.name}} =
static_cast<unsigned>(v); } | 110 void {{field.setter_method_name}}({{field.type_name}} v) { {{field.name}} = st
atic_cast<unsigned>(v); } |
111 {% endif %} | 111 {% endif %} |
112 inline void {{field.resetter_method_name}}() { {{field.name}} = {{default_valu
e(field)}}; } | 112 inline void {{field.resetter_method_name}}() { {{field.name}} = {{default_valu
e(field)}}; } |
113 | 113 |
114 {% endfor %} | 114 {% endfor %} |
115 protected: | 115 protected: |
116 // Storage. | 116 // Storage. |
117 {% for field in fields %} | 117 {% for field in fields %} |
118 unsigned {{field.name}} : {{field.size}}; // {{field.storage_type}} | 118 unsigned {{field.name}} : {{field.size}}; // {{field.type_name}} |
119 {% endfor %} | 119 {% endfor %} |
120 }; | 120 }; |
121 | 121 |
122 } // namespace blink | 122 } // namespace blink |
123 | 123 |
124 #endif // ComputedStyleBase_h | 124 #endif // ComputedStyleBase_h |
OLD | NEW |