Chromium Code Reviews| Index: third_party/WebKit/Source/build/scripts/templates/ComputedStyleBase.h.tmpl |
| diff --git a/third_party/WebKit/Source/build/scripts/templates/ComputedStyleBase.h.tmpl b/third_party/WebKit/Source/build/scripts/templates/ComputedStyleBase.h.tmpl |
| index b72300c1096ea9e3790bef6a13b2bde3bb33fe0b..f63c28002717349e74675ca33c86465e5fc96c9f 100644 |
| --- a/third_party/WebKit/Source/build/scripts/templates/ComputedStyleBase.h.tmpl |
| +++ b/third_party/WebKit/Source/build/scripts/templates/ComputedStyleBase.h.tmpl |
| @@ -1,4 +1,4 @@ |
| -{% from 'macros.tmpl' import license %} |
| +{% from 'macros.tmpl' import license, print_if %} |
| {{license()}} |
| #ifndef ComputedStyleBase_h |
| @@ -11,9 +11,10 @@ |
| {% endfor %} |
| {# Returns the default value for the field, converted to fit in the storage container. #} |
| -{% macro default_value(field) %} |
| +{% macro default_value(field) -%} |
|
sashab
2017/02/19 23:17:03
What's the dashes for?
shend
2017/02/19 23:20:17
They strip out leading/trailing whitespace so you
|
| {# We only support enum fields for now. #} |
| -static_cast<unsigned>({{field.default_value}}){% endmacro %} |
| +static_cast<unsigned>({{field.default_value}}) |
| +{%- endmacro %} |
| namespace blink { |
| @@ -23,25 +24,23 @@ class CORE_EXPORT ComputedStyleBase { |
| public: |
| ALWAYS_INLINE ComputedStyleBase() : |
| {% for field in fields %} |
| - {% set trailing_comma = "," if field != fields[-1] else "" %} |
| - {{field.name}}({{default_value(field)}}){{trailing_comma}} |
| + {{field.name}}({{default_value(field)}}){{print_if(not loop.last, ',')}} |
|
sashab
2017/02/19 23:17:03
Woah loop.last awesome!!
shend
2017/02/19 23:20:17
\o/
|
| {% endfor %} |
| {} |
| ~ComputedStyleBase() {} |
| ALWAYS_INLINE ComputedStyleBase(const ComputedStyleBase& o) : |
| {% for field in fields %} |
| - {% set trailing_comma = "," if field != fields[-1] else "" %} |
| - {{field.name}}(o.{{field.name}}){{trailing_comma}} |
| + {{field.name}}(o.{{field.name}}){{print_if(not loop.last, ',')}} |
| {% endfor %} |
| {} |
| bool operator==(const ComputedStyleBase& o) const { |
| return true && |
| {% for field in fields %} |
| - {{field.name}} == o.{{field.name}} && |
| + {{field.name}} == o.{{field.name}}{{print_if(not loop.last, ' &&')}} |
| {% endfor %} |
| - true; |
| + ; |
| } |
| bool operator!=(const ComputedStyleBase& o) const { return !(*this == o); } |
| @@ -49,33 +48,33 @@ class CORE_EXPORT ComputedStyleBase { |
| inline bool inheritedEqual(const ComputedStyleBase& o) const { |
| return true && |
| {% for field in fields if field.is_property and field.is_inherited %} |
| - {{field.name}} == o.{{field.name}} && |
| + {{field.name}} == o.{{field.name}}{{print_if(not loop.last, ' &&')}} |
| {% endfor %} |
| - true; |
| + ; |
| } |
| inline bool independentInheritedEqual(const ComputedStyleBase& o) const { |
| return true && |
| {% for field in fields if field.is_property and field.is_inherited and field.is_independent %} |
| - {{field.name}} == o.{{field.name}} && |
| + {{field.name}} == o.{{field.name}}{{print_if(not loop.last, ' &&')}} |
| {% endfor %} |
| - true; |
| + ; |
| } |
| inline bool nonIndependentInheritedEqual(const ComputedStyleBase& o) const { |
| return true && |
| {% for field in fields if field.is_property and field.is_inherited and not field.is_independent %} |
| - {{field.name}} == o.{{field.name}} && |
| + {{field.name}} == o.{{field.name}}{{print_if(not loop.last, ' &&')}} |
| {% endfor %} |
| - true; |
| + ; |
| } |
| inline bool nonInheritedEqual(const ComputedStyleBase& o) const { |
| return true && |
| {% for field in fields if field.is_property and not field.is_inherited %} |
| - {{field.name}} == o.{{field.name}} && |
| + {{field.name}} == o.{{field.name}}{{print_if(not loop.last, ' &&')}} |
| {% endfor %} |
| - true; |
| + ; |
| } |
| void setBitDefaults() { |