Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: third_party/WebKit/Source/build/scripts/templates/ComputedStyleBase.h.tmpl

Issue 2896233002: Assert that ComputedStyleBase is only templated with ComputedStyle (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 {% from 'macros.tmpl' import license, print_if %} 1 {% from 'macros.tmpl' import license, print_if %}
2 {% from 'fields/field.tmpl' import encode, getter_expression, setter_expression, declare_storage, fieldwise_compare, fieldwise_copy, fieldwise_diff, fieldwise_p ointer_compare_inherited %} 2 {% from 'fields/field.tmpl' import encode, getter_expression, setter_expression, declare_storage, fieldwise_compare, fieldwise_copy, fieldwise_diff, fieldwise_p ointer_compare_inherited %}
3 {% from 'fields/group.tmpl' import define_field_group_class %} 3 {% from 'fields/group.tmpl' import define_field_group_class %}
4 {{license()}} 4 {{license()}}
5 5
6 #ifndef ComputedStyleBase_h 6 #ifndef ComputedStyleBase_h
7 #define ComputedStyleBase_h 7 #define ComputedStyleBase_h
8 8
9 #include "core/style/ComputedStyleConstants.h" 9 #include "core/style/ComputedStyleConstants.h"
10 #include "core/CoreExport.h" 10 #include "core/CoreExport.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 145
146 // Fields. 146 // Fields.
147 // TODO(sashab): Remove initialFoo() static methods and update callers to 147 // TODO(sashab): Remove initialFoo() static methods and update callers to
148 // use resetFoo(), which can be more efficient. 148 // use resetFoo(), which can be more efficient.
149 149
150 {% for field in computed_style.all_fields %} 150 {% for field in computed_style.all_fields %}
151 // {{field.property_name}} 151 // {{field.property_name}}
152 {{field_templates[field.field_template].decl_public_methods(field)|indent(2)}} 152 {{field_templates[field.field_template].decl_public_methods(field)|indent(2)}}
153 153
154 {% endfor %} 154 {% endfor %}
155
shend 2017/05/23 22:22:48 nit: don't need extra space.
nainar 2017/05/23 23:45:16 Done
155 private: 156 private:
156 {% for subgroup in computed_style.subgroups %} 157 {% for subgroup in computed_style.subgroups %}
157 {{define_field_group_class(subgroup)|indent(2)}} 158 {{define_field_group_class(subgroup)|indent(2)}}
158 159
159 {% endfor %} 160 {% endfor %}
160 161
161 protected: 162 protected:
162 // Constructor and destructor are protected so that only the parent class Comp utedStyle 163 // Constructor and destructor are protected so that only the parent class Comp utedStyle
163 // can instantiate this class. 164 // can instantiate this class.
164 ALWAYS_INLINE ComputedStyleBase() : 165 ALWAYS_INLINE ComputedStyleBase() :
165 {% for field in computed_style.fields %} 166 {% for field in computed_style.fields %}
166 {{field.name}}({{encode(field, field.default_value)}}){{print_if(not loop. last, ',')}} 167 {{field.name}}({{encode(field, field.default_value)}}){{print_if(not loop. last, ',')}}
167 {% endfor %} 168 {% endfor %}
168 { 169 {
169 {% for subgroup in computed_style.subgroups %} 170 {% for subgroup in computed_style.subgroups %}
170 {{subgroup.member_name}}.Init(); 171 {{subgroup.member_name}}.Init();
171 {% endfor %} 172 {% endfor %}
173
174 static_assert(std::is_same<ComputedStyle, ComputedStyleFinal>::value, "Compu tedStyleBase can only be templated with ComputedStyle");
shend 2017/05/23 22:22:47 nit: I would move this closer to the top of the cl
nainar 2017/05/23 23:45:16 Done. Since we talked about this IRL. One of the c
175
172 } 176 }
173 177
174 {% for field in computed_style.all_fields %} 178 {% for field in computed_style.all_fields %}
175 {% if field.field_template in ('storage_only', 'monotonic_flag', 'external') % } 179 {% if field.field_template in ('storage_only', 'monotonic_flag', 'external') % }
176 // {{field.property_name}} 180 // {{field.property_name}}
177 {{field_templates[field.field_template].decl_protected_methods(field)|indent(2 )}} 181 {{field_templates[field.field_template].decl_protected_methods(field)|indent(2 )}}
178 182
179 {% endif %} 183 {% endif %}
180 {% endfor %} 184 {% endfor %}
181 185
(...skipping 12 matching lines...) Expand all
194 198
195 private: 199 private:
196 {% for field in computed_style.fields %} 200 {% for field in computed_style.fields %}
197 {{declare_storage(field)}} 201 {{declare_storage(field)}}
198 {% endfor %} 202 {% endfor %}
199 }; 203 };
200 204
201 } // namespace blink 205 } // namespace blink
202 206
203 #endif // ComputedStyleBase_h 207 #endif // ComputedStyleBase_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698