OLD | NEW |
1 {% from 'macros.tmpl' import license, print_if %} | 1 {% from 'macros.tmpl' import license, print_if %} |
2 {% from 'fields/field.tmpl' import encode, getter_expression, declare_storage %} | 2 {% from 'fields/field.tmpl' import encode, getter_expression, declare_storage, f
ieldwise_compare %} |
3 {% from 'fields/group.tmpl' import define_field_group_class %} | 3 {% from 'fields/group.tmpl' import define_field_group_class %} |
4 {{license()}} | 4 {{license()}} |
5 | 5 |
6 #ifndef ComputedStyleBase_h | 6 #ifndef ComputedStyleBase_h |
7 #define ComputedStyleBase_h | 7 #define ComputedStyleBase_h |
8 | 8 |
9 #include "core/style/ComputedStyleConstants.h" | 9 #include "core/style/ComputedStyleConstants.h" |
10 #include "core/CoreExport.h" | 10 #include "core/CoreExport.h" |
11 #include "core/style/DataRef.h" | 11 #include "core/style/DataRef.h" |
12 {% for path in include_paths %} | 12 {% for path in include_paths %} |
(...skipping 18 matching lines...) Expand all Loading... |
31 } %} | 31 } %} |
32 | 32 |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
35 // The generated portion of ComputedStyle. For more info, see the header comment | 35 // The generated portion of ComputedStyle. For more info, see the header comment |
36 // in ComputedStyle.h. | 36 // in ComputedStyle.h. |
37 class CORE_EXPORT ComputedStyleBase { | 37 class CORE_EXPORT ComputedStyleBase { |
38 public: | 38 public: |
39 inline bool IndependentInheritedEqual(const ComputedStyleBase& o) const { | 39 inline bool IndependentInheritedEqual(const ComputedStyleBase& o) const { |
40 return ( | 40 return ( |
41 {% for field in computed_style.all_fields if field.is_inherited and field.is
_independent %} | 41 {{fieldwise_compare(computed_style, computed_style.all_fields |
42 {{getter_expression(field)}} == o.{{getter_expression(field)}}{{print_if
(not loop.last, ' &&')}} | 42 |selectattr("is_inherited") |
43 {% endfor %} | 43 |selectattr("is_independent") |
| 44 |list |
| 45 )|indent(8)}} |
| 46 true |
44 ); | 47 ); |
45 } | 48 } |
46 | 49 |
47 inline bool NonIndependentInheritedEqual(const ComputedStyleBase& o) const { | 50 inline bool NonIndependentInheritedEqual(const ComputedStyleBase& o) const { |
48 return ( | 51 return ( |
49 {% for field in computed_style.all_fields if field.is_inherited and not fiel
d.is_independent %} | 52 {{fieldwise_compare(computed_style, computed_style.all_fields |
50 {{getter_expression(field)}} == o.{{getter_expression(field)}}{{print_if
(not loop.last, ' &&')}} | 53 |selectattr("is_inherited") |
51 {% endfor %} | 54 |rejectattr("is_independent") |
| 55 |list |
| 56 )|indent(8)}} |
| 57 true |
52 ); | 58 ); |
53 } | 59 } |
54 | 60 |
55 inline bool InheritedEqual(const ComputedStyleBase& o) const { | 61 inline bool InheritedEqual(const ComputedStyleBase& o) const { |
56 return IndependentInheritedEqual(o) && NonIndependentInheritedEqual(o); | 62 return IndependentInheritedEqual(o) && NonIndependentInheritedEqual(o); |
57 } | 63 } |
58 | 64 |
59 inline bool NonInheritedEqual(const ComputedStyleBase& o) const { | 65 inline bool NonInheritedEqual(const ComputedStyleBase& o) const { |
60 return ( | 66 return ( |
61 {% for field in computed_style.all_fields if field.is_property and not field
.is_inherited %} | 67 {{fieldwise_compare(computed_style, computed_style.all_fields |
62 {{getter_expression(field)}} == o.{{getter_expression(field)}}{{print_if
(not loop.last, ' &&')}} | 68 |selectattr("is_property") |
63 {% endfor %} | 69 |rejectattr("is_inherited") |
| 70 |list |
| 71 )|indent(8)}} |
| 72 true |
64 ); | 73 ); |
65 } | 74 } |
66 | 75 |
67 enum IsAtShadowBoundary { | 76 enum IsAtShadowBoundary { |
68 kAtShadowBoundary, | 77 kAtShadowBoundary, |
69 kNotAtShadowBoundary, | 78 kNotAtShadowBoundary, |
70 }; | 79 }; |
71 void InheritFrom(const ComputedStyleBase& inheritParent, | 80 void InheritFrom(const ComputedStyleBase& inheritParent, |
72 IsAtShadowBoundary isAtShadowBoundary = kNotAtShadowBoundary)
; | 81 IsAtShadowBoundary isAtShadowBoundary = kNotAtShadowBoundary)
; |
73 | 82 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 132 |
124 private: | 133 private: |
125 {% for field in computed_style.fields %} | 134 {% for field in computed_style.fields %} |
126 {{declare_storage(field)}} | 135 {{declare_storage(field)}} |
127 {% endfor %} | 136 {% endfor %} |
128 }; | 137 }; |
129 | 138 |
130 } // namespace blink | 139 } // namespace blink |
131 | 140 |
132 #endif // ComputedStyleBase_h | 141 #endif // ComputedStyleBase_h |
OLD | NEW |