| OLD | NEW |
| 1 {% from 'macros.tmpl' import license %} | 1 {% from 'macros.tmpl' import license %} |
| 2 {% from 'fields/field.tmpl' import getter_expression, setter_expression %} |
| 2 {{license()}} | 3 {{license()}} |
| 3 | 4 |
| 4 #include "core/ComputedStyleBase.h" | 5 #include "core/ComputedStyleBase.h" |
| 5 #include "platform/wtf/SizeAssertions.h" | 6 #include "platform/wtf/SizeAssertions.h" |
| 6 | 7 |
| 7 namespace blink { | 8 namespace blink { |
| 8 | 9 |
| 9 struct SameSizeAsComputedStyleBase { | 10 struct SameSizeAsComputedStyleBase { |
| 10 {% for field in fields|rejectattr("is_bit_field") %} | 11 {% if computed_style.subgroups is defined %} |
| 12 void* dataRefs[{{computed_style.subgroups|length}}]; |
| 13 {% endif %} |
| 14 {% for field in computed_style.fields|rejectattr("is_bit_field") %} |
| 11 {{field.type_name}} {{field.name}}}; | 15 {{field.type_name}} {{field.name}}}; |
| 12 {% endfor %} | 16 {% endfor %} |
| 13 unsigned m_bit_fields[{{expected_bit_field_bytes}}]; | 17 unsigned m_bit_fields[{{computed_style.num_32_bit_words_for_bit_fields}}]; |
| 14 }; | 18 }; |
| 19 |
| 15 // If this fails, the packing algorithm in make_computed_style_base.py has | 20 // If this fails, the packing algorithm in make_computed_style_base.py has |
| 16 // failed to produce the optimal packed size. To fix, update the algorithm to | 21 // failed to produce the optimal packed size. To fix, update the algorithm to |
| 17 // ensure that the buckets are placed so that each takes up at most 1 word. | 22 // ensure that the buckets are placed so that each takes up at most 1 word. |
| 18 ASSERT_SIZE(ComputedStyleBase, SameSizeAsComputedStyleBase); | 23 ASSERT_SIZE(ComputedStyleBase, SameSizeAsComputedStyleBase); |
| 19 | 24 |
| 20 void ComputedStyleBase::InheritFrom(const ComputedStyleBase& inheritParent, | 25 void ComputedStyleBase::InheritFrom(const ComputedStyleBase& inheritParent, |
| 21 IsAtShadowBoundary isAtShadowBoundary) { | 26 IsAtShadowBoundary isAtShadowBoundary) { |
| 22 {% for field in fields if field.is_inherited %} | 27 {% for field in computed_style.all_fields if field.is_inherited %} |
| 23 {{field.name}} = inheritParent.{{field.name}}; | 28 {{setter_expression(field)}} = inheritParent.{{getter_expression(field)}}; |
| 24 {% endfor %} | 29 {% endfor %} |
| 25 } | 30 } |
| 26 | 31 |
| 27 void ComputedStyleBase::CopyNonInheritedFromCached( | 32 void ComputedStyleBase::CopyNonInheritedFromCached( |
| 28 const ComputedStyleBase& other) { | 33 const ComputedStyleBase& other) { |
| 29 {% for field in fields if (field.is_property and not field.is_inherited) or fi
eld.is_inherited_flag %} | 34 {% for field in computed_style.all_fields if (field.is_property and not field.
is_inherited) or field.is_inherited_flag %} |
| 30 {{field.name}} = other.{{field.name}}; | 35 {{setter_expression(field)}} = other.{{getter_expression(field)}}; |
| 31 {% endfor %} | 36 {% endfor %} |
| 32 } | 37 } |
| 33 | 38 |
| 34 void ComputedStyleBase::PropagateIndependentInheritedProperties( | 39 void ComputedStyleBase::PropagateIndependentInheritedProperties( |
| 35 const ComputedStyleBase& parentStyle) { | 40 const ComputedStyleBase& parentStyle) { |
| 36 {% for field in fields if field.is_property and field.is_independent %} | 41 {% for field in computed_style.all_fields if field.is_property and field.is_in
dependent %} |
| 37 if ({{field.is_inherited_method_name}}()) | 42 if ({{field.is_inherited_method_name}}()) |
| 38 {{field.setter_method_name}}(parentStyle.{{field.getter_method_name}}()); | 43 {{setter_expression(field)}} = parentStyle.{{getter_expression(field)}}; |
| 39 {% endfor %} | 44 {% endfor %} |
| 40 } | 45 } |
| 41 | 46 |
| 42 } // namespace blink | 47 } // namespace blink |
| OLD | NEW |