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

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

Issue 2905803002: Sort all fields in alphabetical order to make the diffs deterministic (Closed)
Patch Set: Sort fields in tmpl files Created 3 years, 6 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 const ComputedStyleFinal& self = static_cast<const ComputedStyleFinal&>(*thi s); 141 const ComputedStyleFinal& self = static_cast<const ComputedStyleFinal&>(*thi s);
142 {{fieldwise_diff(groups_to_diff)|indent(4)}} 142 {{fieldwise_diff(groups_to_diff)|indent(4)}}
143 return false; 143 return false;
144 } 144 }
145 {% endfor %} 145 {% endfor %}
146 146
147 // Fields. 147 // Fields.
148 // TODO(sashab): Remove initialFoo() static methods and update callers to 148 // TODO(sashab): Remove initialFoo() static methods and update callers to
149 // use resetFoo(), which can be more efficient. 149 // use resetFoo(), which can be more efficient.
150 150
151 {% for field in computed_style.all_fields %} 151 {% for field in computed_style.all_fields|sort(attribute='name') %}
152 // {{field.property_name}} 152 // {{field.property_name}}
153 {{field_templates[field.field_template].decl_public_methods(field)|indent(2)}} 153 {{field_templates[field.field_template].decl_public_methods(field)|indent(2)}}
154 154
155 {% endfor %} 155 {% endfor %}
156 private: 156 private:
157 {% for subgroup in computed_style.subgroups %} 157 {% for subgroup in computed_style.subgroups %}
158 {{define_field_group_class(subgroup)|indent(2)}} 158 {{define_field_group_class(subgroup)|indent(2)}}
159 159
160 {% endfor %} 160 {% endfor %}
161 161
162 protected: 162 protected:
163 // 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
164 // can instantiate this class. 164 // can instantiate this class.
165 ALWAYS_INLINE ComputedStyleBase() : 165 ALWAYS_INLINE ComputedStyleBase() :
166 {% for field in computed_style.fields %} 166 {% for field in computed_style.fields %}
167 {{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, ',')}}
168 {% endfor %} 168 {% endfor %}
169 { 169 {
170 static_assert(std::is_same<ComputedStyle, ComputedStyleFinal>::value, "Compu tedStyleBase can only be templated with ComputedStyle"); 170 static_assert(std::is_same<ComputedStyle, ComputedStyleFinal>::value, "Compu tedStyleBase can only be templated with ComputedStyle");
171 {% for subgroup in computed_style.subgroups %} 171 {% for subgroup in computed_style.subgroups %}
172 {{subgroup.member_name}}.Init(); 172 {{subgroup.member_name}}.Init();
173 {% endfor %} 173 {% endfor %}
174 } 174 }
175 175
176 {% for field in computed_style.all_fields %} 176 {% for field in computed_style.all_fields|sort(attribute='name') %}
177 {% if field.field_template in ('storage_only', 'monotonic_flag', 'external') % } 177 {% if field.field_template in ('storage_only', 'monotonic_flag', 'external') % }
178 // {{field.property_name}} 178 // {{field.property_name}}
179 {{field_templates[field.field_template].decl_protected_methods(field)|indent(2 )}} 179 {{field_templates[field.field_template].decl_protected_methods(field)|indent(2 )}}
180 180
181 {% endif %} 181 {% endif %}
182 {% endfor %} 182 {% endfor %}
183 183
184 ~ComputedStyleBase() = default; 184 ~ComputedStyleBase() = default;
185 185
186 // Storage. 186 // Storage.
187 {% for subgroup in computed_style.subgroups %} 187 {% for subgroup in computed_style.subgroups %}
188 DataRef<{{subgroup.type_name}}> {{subgroup.member_name}}; 188 DataRef<{{subgroup.type_name}}> {{subgroup.member_name}};
189 {% endfor %} 189 {% endfor %}
190 190
191 static unsigned WidthToFixedPoint(float width) { 191 static unsigned WidthToFixedPoint(float width) {
192 DCHECK_GE(width, 0); 192 DCHECK_GE(width, 0);
193 return static_cast<unsigned>(std::min<float>(width, kMaxForBorderWidth) * 193 return static_cast<unsigned>(std::min<float>(width, kMaxForBorderWidth) *
194 kBorderWidthDenominator); 194 kBorderWidthDenominator);
195 } 195 }
196 196
197 private: 197 private:
198 {% for field in computed_style.fields %} 198 {% for field in computed_style.fields %}
199 {{declare_storage(field)}} 199 {{declare_storage(field)}}
200 {% endfor %} 200 {% endfor %}
201 }; 201 };
202 202
203 } // namespace blink 203 } // namespace blink
204 204
205 #endif // ComputedStyleBase_h 205 #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