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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/build/scripts/templates/fields/base.tmpl
diff --git a/third_party/WebKit/Source/build/scripts/templates/fields/base.tmpl b/third_party/WebKit/Source/build/scripts/templates/fields/base.tmpl
index 2a0bc8e5e521451da029f6877fd9152f260188a9..dc328f9d8543e6a35137d6ae1692c71c0a6054cb 100644
--- a/third_party/WebKit/Source/build/scripts/templates/fields/base.tmpl
+++ b/third_party/WebKit/Source/build/scripts/templates/fields/base.tmpl
@@ -1,12 +1,12 @@
{% from 'fields/field.tmpl' import encode, decode, return_type %}
-{% macro decl_methods(field) -%}
-inline static {{return_type(field)}} {{field.initial_method_name}}() {
+{% macro decl_public_methods(field) -%}
+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.
return {{field.default_value}};
}
{{return_type(field)}} {{field.getter_method_name}}() const {
return {{decode(field, field.name)}};
}
-void {{field.setter_method_name}}({{field.type_name}} v) {
+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
{{field.name}} = {{encode(field, "v")}};
}
inline void {{field.resetter_method_name}}() {
@@ -14,3 +14,11 @@ inline void {{field.resetter_method_name}}() {
}
{%- endmacro %}
+{% macro decl_protected_methods(field) -%}
+{{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
+ return {{decode(field, field.name)}};
+}
+void {{field.internal_setter_method_name}}({{field.type_name}} v) {
+ {{field.name}} = {{encode(field, "v")}};
+}
+{%- endmacro %}

Powered by Google App Engine
This is Rietveld 408576698