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.field_type_path != None %} |
10 #include "{{field.storage_type_path}}.h" | 10 #include "{{field.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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 void copyNonInheritedFromCached(const ComputedStyleBase& other); | 93 void copyNonInheritedFromCached(const ComputedStyleBase& other); |
94 | 94 |
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 |
103 {% for field in fields %} | 104 {% for field in fields %} |
104 // {{field.property_name}} | 105 // {{field.property_name}} |
105 inline static {{field.storage_type}} {{field.initial_method_name}}() { return
{{field.default_value}}; } | 106 inline static {{field.type_name}} {{field.initial_method_name}}() { |
106 {{field.storage_type}} {{field.getter_method_name}}() const { return static_ca
st<{{field.storage_type}}>({{field.name}}); } | 107 return {{field.default_value}}; |
| 108 } |
| 109 {{field.type_name}} {{field.getter_method_name}}() const { |
| 110 return static_cast<{{field.type_name}}>({{field.name}}); |
| 111 } |
107 {% if field.is_nonproperty %} | 112 {% if field.is_nonproperty %} |
108 void {{field.setter_method_name}}() { {{field.name}} = static_cast<unsigned>(t
rue); } | 113 void {{field.setter_method_name}}() { |
| 114 {{field.name}} = static_cast<unsigned>(true); |
| 115 } |
109 {% else %} | 116 {% else %} |
110 void {{field.setter_method_name}}({{field.storage_type}} v) { {{field.name}} =
static_cast<unsigned>(v); } | 117 void {{field.setter_method_name}}({{field.type_name}} v) { |
| 118 {{field.name}} = static_cast<unsigned>(v); |
| 119 } |
111 {% endif %} | 120 {% endif %} |
112 inline void {{field.resetter_method_name}}() { {{field.name}} = {{default_valu
e(field)}}; } | 121 inline void {{field.resetter_method_name}}() { |
| 122 {{field.name}} = {{default_value(field)}}; |
| 123 } |
113 | 124 |
114 {% endfor %} | 125 {% endfor %} |
115 protected: | 126 protected: |
116 // Storage. | 127 // Storage. |
117 {% for field in fields %} | 128 {% for field in fields %} |
118 unsigned {{field.name}} : {{field.size}}; // {{field.storage_type}} | 129 unsigned {{field.name}} : {{field.size}}; // {{field.type_name}} |
119 {% endfor %} | 130 {% endfor %} |
120 }; | 131 }; |
121 | 132 |
122 } // namespace blink | 133 } // namespace blink |
123 | 134 |
124 #endif // ComputedStyleBase_h | 135 #endif // ComputedStyleBase_h |
OLD | NEW |