| Index: third_party/WebKit/Source/build/scripts/templates/ComputedStyleBase.cpp.tmpl
|
| diff --git a/third_party/WebKit/Source/build/scripts/templates/ComputedStyleBase.cpp.tmpl b/third_party/WebKit/Source/build/scripts/templates/ComputedStyleBase.cpp.tmpl
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..5a95aaaccfc5fca6e1cff06a9c22ef764c83f3d0
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/build/scripts/templates/ComputedStyleBase.cpp.tmpl
|
| @@ -0,0 +1,78 @@
|
| +{% from 'macros.tmpl' import license, print_if %}
|
| +{% from 'fields/field.tmpl' import encode, getter_expression, setter_expression, fieldwise_copy, fieldwise_diff %}
|
| +{% from 'fields/group.tmpl' import define_field_group_class %}
|
| +{{license()}}
|
| +
|
| +#include "core/ComputedStyleBase.h"
|
| +#include "core/style/ComputedStyle.h"
|
| +#include "platform/wtf/SizeAssertions.h"
|
| +
|
| +namespace blink {
|
| +
|
| +struct SameSizeAsComputedStyleBase {
|
| + {% if computed_style.subgroups is defined %}
|
| + void* dataRefs[{{computed_style.subgroups|length}}];
|
| + {% endif %}
|
| + {% for field in computed_style.fields|rejectattr("is_bit_field") %}
|
| + {{field.type_name}} {{field.name}};
|
| + {% endfor %}
|
| + unsigned m_bit_fields[{{computed_style.num_32_bit_words_for_bit_fields}}];
|
| +};
|
| +
|
| +// If this fails, the packing algorithm in make_computed_style_base.py has
|
| +// failed to produce the optimal packed size. To fix, update the algorithm to
|
| +// ensure that the buckets are placed so that each takes up at most 1 word.
|
| +ASSERT_SIZE(ComputedStyleBase, SameSizeAsComputedStyleBase);
|
| +
|
| +// Constructor and destructor are protected so that only the parent class ComputedStyle
|
| +// can instantiate this class.
|
| +ComputedStyleBase::ComputedStyleBase() :
|
| +{% for field in computed_style.fields %}
|
| + {{field.name}}({{encode(field, field.default_value)}}){{print_if(not loop.last, ',')}}
|
| +{% endfor %}
|
| +{
|
| + {% for subgroup in computed_style.subgroups %}
|
| + {{subgroup.member_name}}.Init();
|
| + {% endfor %}
|
| +}
|
| +
|
| +void ComputedStyleBase::InheritFrom(const ComputedStyleBase& other,
|
| + IsAtShadowBoundary isAtShadowBoundary) {
|
| + {{fieldwise_copy(computed_style, computed_style.all_fields
|
| + |selectattr("is_property")
|
| + |selectattr("is_inherited")
|
| + |list
|
| + )|indent(2)}}
|
| +}
|
| +
|
| +void ComputedStyleBase::CopyNonInheritedFromCached(
|
| + const ComputedStyleBase& other) {
|
| + {{fieldwise_copy(computed_style, computed_style.all_fields
|
| + |rejectattr("has_custom_compare_and_copy")
|
| + |rejectattr("is_inherited")
|
| + |list
|
| + )|indent(2)}}
|
| +}
|
| +
|
| +void ComputedStyleBase::PropagateIndependentInheritedProperties(
|
| + const ComputedStyleBase& parentStyle) {
|
| + {% for field in computed_style.all_fields if field.is_property and field.is_independent %}
|
| + if ({{field.is_inherited_method_name}}())
|
| + {{setter_expression(field)}} = parentStyle.{{getter_expression(field)}};
|
| + {% endfor %}
|
| +}
|
| +
|
| +{% for name, groups_to_diff in diff_functions_map.items() %}
|
| +bool ComputedStyleBase::{{name}}(const ComputedStyle& a, const ComputedStyle& b) {
|
| + {{fieldwise_diff(groups_to_diff)|indent(4)}}
|
| + return false;
|
| +}
|
| +
|
| +{% endfor %}
|
| +
|
| +{% for group in computed_style.subgroups %}
|
| +{{define_field_group_class(group)}}
|
| +
|
| +{% endfor %}
|
| +
|
| +} // namespace blink
|
|
|