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/field.tmpl

Issue 2879493003: Check if value changed when setting nested fields in ComputedStyleBase. (Closed)
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/build/scripts/templates/fields/field.tmpl
diff --git a/third_party/WebKit/Source/build/scripts/templates/fields/field.tmpl b/third_party/WebKit/Source/build/scripts/templates/fields/field.tmpl
index f029a40e5c487708e30fb14dce93c5d416ef31a6..11474ec1496479ba07715453fc022b31dc19298a 100644
--- a/third_party/WebKit/Source/build/scripts/templates/fields/field.tmpl
+++ b/third_party/WebKit/Source/build/scripts/templates/fields/field.tmpl
@@ -30,6 +30,15 @@ static_cast<{{field.type_name}}>({{value}})
{%- endif %}
{% endmacro %}
+{% macro set_if_changed(field, value) %}
+{% if field.group_member_name -%}
+if (!({{getter_expression(field)}} == {{value}}))
+ {{setter_expression(field)}} = {{value}};
+{%- else -%}
+{{field.name}} = {{value}};
+{%- endif %}
+{% endmacro %}
+
{% macro nonconst_ref(field) %}
{% if field.is_bit_field -%}
{{field.type_name}}
@@ -99,4 +108,4 @@ if ({{subgroup.member_name}}.Get() != other.{{subgroup.member_name}}.Get()) {
if ({{getter_expression(field)}} != other.{{getter_expression(field)}})
return true;
{% endfor %}
-{% endmacro %}
+{% endmacro %}

Powered by Google App Engine
This is Rietveld 408576698