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

Unified Diff: third_party/WebKit/Source/build/scripts/templates/fields/storage_only.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/storage_only.tmpl
diff --git a/third_party/WebKit/Source/build/scripts/templates/fields/storage_only.tmpl b/third_party/WebKit/Source/build/scripts/templates/fields/storage_only.tmpl
index 551d2cc1b6d9d37d2e5c19da37b776bc01b92c44..4c7ad46b2fb567f9977bb1055006588fd79f6855 100644
--- a/third_party/WebKit/Source/build/scripts/templates/fields/storage_only.tmpl
+++ b/third_party/WebKit/Source/build/scripts/templates/fields/storage_only.tmpl
@@ -1,3 +1,22 @@
-{% macro decl_methods(field) -%}
+{% from 'fields/field.tmpl' import encode, decode, getter_expression, setter_expression, return_type %}
+{% macro decl_public_methods(field) -%}
// Getters and setters not generated
{%- endmacro %}
+{% macro decl_protected_methods(field) -%}
+{% if field.is_bit_field != 1 %}
shend 2017/04/19 03:41:29 You can do: "{% if field.is_bit_field %} ... {% el
nainar 2017/04/19 04:02:46 Yup. That is better.
+const {{return_type(field)}} {{field.getter_method_name}}() const {
+ return {{decode(field, getter_expression(field))}};
+}
+{{field.type_name}}& {{field.mutable_method_name}}() {
+ return {{decode(field, getter_expression(field))}};
+}
+{% else %}
+{{return_type(field)}} {{field.getter_method_name}}() const {
+ return {{decode(field, getter_expression(field))}};
+}
+{% endif %}
+void {{field.setter_method_name}}(const {{field.type_name}}& v) {
+ {{setter_expression(field)}} = {{encode(field, "v")}};
+}
+{%- endmacro %}
+

Powered by Google App Engine
This is Rietveld 408576698