| OLD | NEW |
| (Empty) |
| 1 {% from 'macros.tmpl' import license %} | |
| 2 {% from 'fields/field.tmpl' import getter_expression, setter_expression, fieldwi
se_copy, fieldwise_diff %} | |
| 3 {{license()}} | |
| 4 | |
| 5 #include "core/ComputedStyleBase.h" | |
| 6 #include "platform/wtf/SizeAssertions.h" | |
| 7 | |
| 8 namespace blink { | |
| 9 | |
| 10 struct SameSizeAsComputedStyleBase { | |
| 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") %} | |
| 15 {{field.type_name}} {{field.name}}; | |
| 16 {% endfor %} | |
| 17 unsigned m_bit_fields[{{computed_style.num_32_bit_words_for_bit_fields}}]; | |
| 18 }; | |
| 19 | |
| 20 // If this fails, the packing algorithm in make_computed_style_base.py has | |
| 21 // failed to produce the optimal packed size. To fix, update the algorithm to | |
| 22 // ensure that the buckets are placed so that each takes up at most 1 word. | |
| 23 ASSERT_SIZE(ComputedStyleBase, SameSizeAsComputedStyleBase); | |
| 24 | |
| 25 void ComputedStyleBase::InheritFrom(const ComputedStyleBase& other, | |
| 26 IsAtShadowBoundary isAtShadowBoundary) { | |
| 27 {{fieldwise_copy(computed_style, computed_style.all_fields | |
| 28 |selectattr("is_property") | |
| 29 |selectattr("is_inherited") | |
| 30 |list | |
| 31 )|indent(2)}} | |
| 32 } | |
| 33 | |
| 34 void ComputedStyleBase::CopyNonInheritedFromCached( | |
| 35 const ComputedStyleBase& other) { | |
| 36 {{fieldwise_copy(computed_style, computed_style.all_fields | |
| 37 |rejectattr("has_custom_compare_and_copy") | |
| 38 |rejectattr("is_inherited") | |
| 39 |list | |
| 40 )|indent(2)}} | |
| 41 } | |
| 42 | |
| 43 void ComputedStyleBase::PropagateIndependentInheritedProperties( | |
| 44 const ComputedStyleBase& parentStyle) { | |
| 45 {% for field in computed_style.all_fields if field.is_property and field.is_in
dependent %} | |
| 46 if ({{field.is_inherited_method_name}}()) | |
| 47 {{setter_expression(field)}} = parentStyle.{{getter_expression(field)}}; | |
| 48 {% endfor %} | |
| 49 } | |
| 50 | |
| 51 bool ComputedStyleBase::ScrollAnchorDisablingPropertyChanged( | |
| 52 const ComputedStyleBase& other, | |
| 53 const StyleDifference& diff) const { | |
| 54 {{fieldwise_diff(computed_style, computed_style.all_fields | |
| 55 |selectattr("property_name", "in", ["margin-top", "margin-left", "margin-r
ight", "margin-bottom", "left", "right", "top", "bottom", "padding-top", "paddin
g-left", "padding-right", "padding-bottom"]) | |
| 56 |list | |
| 57 )|indent(2)}} | |
| 58 return false; | |
| 59 } | |
| 60 | |
| 61 bool ComputedStyleBase::DiffNeedsFullLayoutAndPaintInvalidation( | |
| 62 const ComputedStyleBase& other) const { | |
| 63 {{fieldwise_diff(computed_style, computed_style.all_fields | |
| 64 |selectattr("property_name", "in", ["padding-top", "padding-left", "paddin
g-right", "padding-bottom"]) | |
| 65 |list | |
| 66 )|indent(2)}} | |
| 67 return false; | |
| 68 } | |
| 69 | |
| 70 } // namespace blink | |
| OLD | NEW |