Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 {% from 'macros.tmpl' import license %} | 1 {% from 'macros.tmpl' import license %} |
| 2 {% from 'fields/field.tmpl' import get_expr, set_expr %} | |
| 2 {{license()}} | 3 {{license()}} |
| 3 | 4 |
| 4 #include "core/ComputedStyleBase.h" | 5 #include "core/ComputedStyleBase.h" |
| 5 #include "wtf/SizeAssertions.h" | 6 #include "wtf/SizeAssertions.h" |
| 6 | 7 |
| 7 namespace blink { | 8 namespace blink { |
| 8 | 9 |
| 9 struct SameSizeAsComputedStyleBase { | 10 struct SameSizeAsComputedStyleBase { |
|
meade_UTC10
2017/04/06 03:29:57
Did we end up making a decision about whether or n
shend
2017/04/06 04:39:40
I think the decision with this was to make a CL to
| |
| 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_bit_field_buckets}}]; |
| 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 {{set_expr(field)}} = inheritParent.{{get_expr(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 {{set_expr(field)}} = other.{{get_expr(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 {{set_expr(field)}} = parentStyle.{{get_expr(field)}}; |
| 39 {% endfor %} | 44 {% endfor %} |
| 40 } | 45 } |
| 41 | 46 |
| 42 } // namespace blink | 47 } // namespace blink |
| OLD | NEW |