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 c9425504570bae6c8afcc3658ecc82f5cbbf2d79..d140fc58adb3df52894eb47601d1fed64acac8b7 100644 |
--- a/third_party/WebKit/Source/build/scripts/templates/ComputedStyleBase.h.tmpl |
+++ b/third_party/WebKit/Source/build/scripts/templates/ComputedStyleBase.h.tmpl |
@@ -19,6 +19,7 @@ namespace blink { |
// in ComputedStyle.h. |
class CORE_EXPORT ComputedStyleBase : public RefCounted<ComputedStyleBase> { |
public: |
+ // Empty constructor. |
ALWAYS_INLINE ComputedStyleBase() : |
RefCounted<ComputedStyleBase>(), |
{% for field in fields %} |
@@ -28,6 +29,7 @@ public: |
{} |
~ComputedStyleBase() {} |
+ // Copy constructor. |
ALWAYS_INLINE ComputedStyleBase(const ComputedStyleBase& o) : |
{% for field in fields %} |
{% set trailing_comma = "," if field != fields[-1] else "" %} |
@@ -35,6 +37,7 @@ public: |
{% endfor %} |
{} |
+ // Comparison functions. |
bool operator==(const ComputedStyleBase& o) const |
{ |
return true |
@@ -49,7 +52,7 @@ public: |
inline bool inheritedEqual(const ComputedStyleBase& o) const |
{ |
return true |
- {% for field in fields if field.property['inherited'] %} |
+ {% for field in fields if field.comparison_function_independent_inherited or field.comparison_function_non_independent_inherited %} |
&& {{field.name}} == o.{{field.name}} |
{% endfor %} |
&& true; |
@@ -58,7 +61,7 @@ public: |
inline bool independentInheritedEqual(const ComputedStyleBase& o) const |
{ |
return true |
- {% for field in fields if field.property['inherited'] and field.property['independent'] %} |
+ {% for field in fields if field.comparison_function_independent_inherited %} |
&& {{field.name}} == o.{{field.name}} |
{% endfor %} |
&& true; |
@@ -67,7 +70,7 @@ public: |
inline bool nonIndependentInheritedEqual(const ComputedStyleBase& o) const |
{ |
return true |
- {% for field in fields if field.property['inherited'] and not field.property['independent'] %} |
+ {% for field in fields if field.comparison_function_non_independent_inherited %} |
&& {{field.name}} == o.{{field.name}} |
{% endfor %} |
&& true; |
@@ -76,16 +79,17 @@ public: |
inline bool nonInheritedEqual(const ComputedStyleBase& o) const |
{ |
return true |
- {% for field in fields if not field.property['inherited'] %} |
+ {% for field in fields if field.comparison_function_non_inherited %} |
&& {{field.name}} == o.{{field.name}} |
{% endfor %} |
&& true; |
} |
+ // Resets all fields to their default values. |
void setBitDefaults() |
{ |
{% for field in fields %} |
- reset{{field.property['upper_camel_name']}}(); |
+ reset{{field.upper_camel_name}}(); |
{% endfor %} |
} |
@@ -94,18 +98,23 @@ public: |
NotAtShadowBoundary, |
}; |
void inheritFrom(const ComputedStyleBase& inheritParent, IsAtShadowBoundary isAtShadowBoundary = NotAtShadowBoundary); |
+ void copyNonInheritedFromCached(const ComputedStyleBase&); |
+ void propagateIndependentInheritedProperties(const ComputedStyleBase& parentStyle); |
// Fields. |
- // TODO(sashab): Remove initialFoo() static methods and update callers to |
- // use resetFoo(), which can be more efficient. |
+ // TODO(sashab): Remove initialFoo() static methods and update callers to use |
+ // resetFoo(), which can be made more efficient. |
+ |
+ {% for property_name, fields in fields_per_property.items() if fields %} |
+ // {{property_name}} |
{% for field in fields %} |
- // {{field.property['name']}} |
- inline static {{field.type}} initial{{field.property['upper_camel_name']}}() { return {{field.default_value}}; } |
- {{field.type}} {{field.property['lower_camel_name']}}() const { return static_cast<{{field.type}}>({{field.name}}); } |
- void set{{field.property['upper_camel_name']}}({{field.type}} v) { {{field.name}} = static_cast<unsigned>(v); } |
- inline void reset{{field.property['upper_camel_name']}}() { {{field.name}} = {{default_value(field)}}; } |
+ inline static {{field.type}} initial{{field.upper_camel_name}}() { return {{field.default_value}}; } |
+ {{field.type}} {{field.lower_camel_name}}() const { return static_cast<{{field.type}}>({{field.name}}); } |
+ void set{{field.upper_camel_name}}({{field.type}} v) { {{field.name}} = static_cast<unsigned>(v); } |
+ inline void reset{{field.upper_camel_name}}() { {{field.name}} = {{default_value(field)}}; } |
{% endfor %} |
+ {% endfor %} |
protected: |
// Storage. |
{% for field in fields %} |