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

Side by Side Diff: third_party/WebKit/Source/build/scripts/templates/fields/base.tmpl

Issue 2826653002: Generate getters/setters for some fields on groups in ComputedStyle (Closed)
Patch Set: Incorporating shend@'s suggestions Created 3 years, 8 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 'fields/field.tmpl' import encode, decode, return_type %} 1 {% from 'fields/field.tmpl' import encode, decode, return_type %}
2 {% macro decl_methods(field) -%} 2 {% macro decl_public_methods(field) -%}
3 inline static {{return_type(field)}} {{field.initial_method_name}}() { 3 inline static {{field.type_name}} {{field.initial_method_name}}() {
suzyh_UTC10 (ex-contributor) 2017/04/19 08:03:33 Why the change from return_type(field) to field.ty
nainar 2017/04/19 08:49:35 Mistake. Fixed.
4 return {{field.default_value}}; 4 return {{field.default_value}};
5 } 5 }
6 {{return_type(field)}} {{field.getter_method_name}}() const { 6 {{return_type(field)}} {{field.getter_method_name}}() const {
7 return {{decode(field, field.name)}}; 7 return {{decode(field, field.name)}};
8 } 8 }
9 void {{field.setter_method_name}}({{field.type_name}} v) { 9 void {{field.setter_method_name}}(const {{field.type_name}}& v) {
suzyh_UTC10 (ex-contributor) 2017/04/19 08:03:33 This is resulting in a rather odd-looking "const b
nainar 2017/04/19 08:49:35 Fixed by using new argument_type macro
10 {{field.name}} = {{encode(field, "v")}}; 10 {{field.name}} = {{encode(field, "v")}};
11 } 11 }
12 inline void {{field.resetter_method_name}}() { 12 inline void {{field.resetter_method_name}}() {
13 {{field.name}} = {{encode(field, field.default_value)}}; 13 {{field.name}} = {{encode(field, field.default_value)}};
14 } 14 }
15 {%- endmacro %} 15 {%- endmacro %}
16 16
17 {% macro decl_protected_methods(field) -%}
18 {{return_type(field)}} {{field.internal_getter_method_name}}() const {
suzyh_UTC10 (ex-contributor) 2017/04/19 08:03:33 On first glance it's not clear why there's an inte
nainar 2017/04/19 08:49:35 They are the same except the ones I am adding are
19 return {{decode(field, field.name)}};
20 }
21 void {{field.internal_setter_method_name}}({{field.type_name}} v) {
22 {{field.name}} = {{encode(field, "v")}};
23 }
24 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698