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

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: Adds protected methods for all fields that need it 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..c7fea9f3f8d4adcd7bcf6b6306bb068b10d495ef 100644
--- a/third_party/WebKit/Source/build/scripts/templates/fields/base.tmpl
+++ b/third_party/WebKit/Source/build/scripts/templates/fields/base.tmpl
@@ -1,6 +1,21 @@
-{% from 'fields/field.tmpl' import encode, decode, return_type %}
-{% macro decl_methods(field) -%}
-inline static {{return_type(field)}} {{field.initial_method_name}}() {
+{% from 'fields/field.tmpl' import encode, decode, getter_expression, setter_expression, return_type %}
+{% macro decl_public_methods(field) -%}
+inline static {{field.type_name}} {{field.initial_method_name}}() {
shend 2017/04/19 03:41:29 There's a lot of code duplication here now :( Mayb
nainar 2017/04/19 04:02:46 Will take a look at this in a later patch
+ return {{field.default_value}};
+}
+{{return_type(field)}} {{field.getter_method_name}}() const {
+ return {{decode(field, getter_expression(field))}};
+}
+void {{field.setter_method_name}}(const {{field.type_name}}& v) {
+ {{setter_expression(field)}} = {{encode(field, "v")}};
+}
+inline void {{field.resetter_method_name}}() {
+ {{setter_expression(field)}} = {{encode(field, field.default_value)}};
+}
+{%- endmacro %}
+
+{% macro decl_protected_methods(field) -%}
+inline static {{field.type_name}} {{field.initial_method_name}}() {
shend 2017/04/19 03:41:29 We probably won't need protected initial and reset
nainar 2017/04/19 04:02:46 Removed.
return {{field.default_value}};
}
{{return_type(field)}} {{field.getter_method_name}}() const {
@@ -13,4 +28,3 @@ inline void {{field.resetter_method_name}}() {
{{field.name}} = {{encode(field, field.default_value)}};
}
{%- endmacro %}
-

Powered by Google App Engine
This is Rietveld 408576698