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

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

Issue 2876803003: Generate diffs for fields in ComputedStyle that use their public getters (Closed)
Patch Set: shend@'s suggestions 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
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 %} 2 {% from 'fields/field.tmpl' import encode, getter_expression, setter_expression, declare_storage, fieldwise_compare, fieldwise_copy, fieldwise_diff %}
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 void PropagateIndependentInheritedProperties( 121 void PropagateIndependentInheritedProperties(
122 const ComputedStyleBase& parentStyle) { 122 const ComputedStyleBase& parentStyle) {
123 {% for field in computed_style.all_fields if field.is_property and field.is_ independent %} 123 {% for field in computed_style.all_fields if field.is_property and field.is_ independent %}
124 if ({{field.is_inherited_method_name}}()) 124 if ({{field.is_inherited_method_name}}())
125 {{setter_expression(field)}} = parentStyle.{{getter_expression(field)}}; 125 {{setter_expression(field)}} = parentStyle.{{getter_expression(field)}};
126 {% endfor %} 126 {% endfor %}
127 } 127 }
128 128
129 {% for name, groups_to_diff in diff_functions_map.items() %} 129 {% for name, groups_to_diff in diff_functions_map.items() %}
130 bool {{name}}(const ComputedStyleFinal& other) const { 130 bool {{name}}(const ComputedStyleFinal& other) const {
131 {{fieldwise_diff(groups_to_diff)|indent(2)}} 131 const ComputedStyleFinal& self = static_cast<const ComputedStyleFinal&>(*thi s);
132 {{fieldwise_diff(self, groups_to_diff)|indent(2)}}
shend 2017/05/12 07:10:41 might have to be "self" in quotes.
nainar 2017/05/12 07:14:31 yup. lol .done
132 return false; 133 return false;
133 } 134 }
134 {% endfor %} 135 {% endfor %}
135 136
136 // Fields. 137 // Fields.
137 // TODO(sashab): Remove initialFoo() static methods and update callers to 138 // TODO(sashab): Remove initialFoo() static methods and update callers to
138 // use resetFoo(), which can be more efficient. 139 // use resetFoo(), which can be more efficient.
139 140
140 {% for field in computed_style.all_fields %} 141 {% for field in computed_style.all_fields %}
141 // {{field.property_name}} 142 // {{field.property_name}}
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 185
185 private: 186 private:
186 {% for field in computed_style.fields %} 187 {% for field in computed_style.fields %}
187 {{declare_storage(field)}} 188 {{declare_storage(field)}}
188 {% endfor %} 189 {% endfor %}
189 }; 190 };
190 191
191 } // namespace blink 192 } // namespace blink
192 193
193 #endif // ComputedStyleBase_h 194 #endif // ComputedStyleBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698