OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef StyleDifference_h | 5 #ifndef StyleDifference_h |
6 #define StyleDifference_h | 6 #define StyleDifference_h |
7 | 7 |
| 8 #include <iosfwd> |
| 9 #include "core/CoreExport.h" |
8 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
9 #include "wtf/Assertions.h" | 11 #include "wtf/Assertions.h" |
10 | 12 |
11 namespace blink { | 13 namespace blink { |
12 | 14 |
13 class StyleDifference { | 15 class StyleDifference { |
14 STACK_ALLOCATED(); | 16 STACK_ALLOCATED(); |
15 | 17 |
16 public: | 18 public: |
17 enum PropertyDifference { | 19 enum PropertyDifference { |
18 TransformChanged = 1 << 0, | 20 TransformChanged = 1 << 0, |
19 OpacityChanged = 1 << 1, | 21 OpacityChanged = 1 << 1, |
20 ZIndexChanged = 1 << 2, | 22 ZIndexChanged = 1 << 2, |
21 FilterChanged = 1 << 3, | 23 FilterChanged = 1 << 3, |
22 BackdropFilterChanged = 1 << 4, | 24 BackdropFilterChanged = 1 << 4, |
23 CSSClipChanged = 1 << 5, | 25 CSSClipChanged = 1 << 5, |
24 // The object needs to issue paint invalidations if it is affected by text | 26 // The object needs to issue paint invalidations if it is affected by text |
25 // decorations or properties dependent on color (e.g., border or outline). | 27 // decorations or properties dependent on color (e.g., border or outline). |
26 TextDecorationOrColorChanged = 1 << 6, | 28 TextDecorationOrColorChanged = 1 << 6, |
27 // If you add a value here, be sure to update the number of bits on | 29 // If you add a value here, be sure to update kPropertyDifferenceCount. |
28 // m_propertySpecificDifferences. | |
29 }; | 30 }; |
30 | 31 |
31 StyleDifference() | 32 StyleDifference() |
32 : m_paintInvalidationType(NoPaintInvalidation), | 33 : m_paintInvalidationType(NoPaintInvalidation), |
33 m_layoutType(NoLayout), | 34 m_layoutType(NoLayout), |
34 m_recomputeOverflow(false), | 35 m_recomputeOverflow(false), |
35 m_propertySpecificDifferences(0), | 36 m_propertySpecificDifferences(0), |
36 m_scrollAnchorDisablingPropertyChanged(false) {} | 37 m_scrollAnchorDisablingPropertyChanged(false) {} |
37 | 38 |
38 bool hasDifference() const { | 39 bool hasDifference() const { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 } | 133 } |
133 | 134 |
134 bool scrollAnchorDisablingPropertyChanged() const { | 135 bool scrollAnchorDisablingPropertyChanged() const { |
135 return m_scrollAnchorDisablingPropertyChanged; | 136 return m_scrollAnchorDisablingPropertyChanged; |
136 } | 137 } |
137 void setScrollAnchorDisablingPropertyChanged() { | 138 void setScrollAnchorDisablingPropertyChanged() { |
138 m_scrollAnchorDisablingPropertyChanged = true; | 139 m_scrollAnchorDisablingPropertyChanged = true; |
139 } | 140 } |
140 | 141 |
141 private: | 142 private: |
| 143 static constexpr int kPropertyDifferenceCount = 7; |
| 144 |
| 145 friend CORE_EXPORT std::ostream& operator<<(std::ostream&, |
| 146 const StyleDifference&); |
| 147 |
142 enum PaintInvalidationType { | 148 enum PaintInvalidationType { |
143 NoPaintInvalidation, | 149 NoPaintInvalidation, |
144 PaintInvalidationObject, | 150 PaintInvalidationObject, |
145 PaintInvalidationSubtree, | 151 PaintInvalidationSubtree, |
146 }; | 152 }; |
147 unsigned m_paintInvalidationType : 2; | 153 unsigned m_paintInvalidationType : 2; |
148 | 154 |
149 enum LayoutType { NoLayout = 0, PositionedMovement, FullLayout }; | 155 enum LayoutType { NoLayout = 0, PositionedMovement, FullLayout }; |
150 unsigned m_layoutType : 2; | 156 unsigned m_layoutType : 2; |
151 unsigned m_recomputeOverflow : 1; | 157 unsigned m_recomputeOverflow : 1; |
152 unsigned m_propertySpecificDifferences : 7; | 158 unsigned m_propertySpecificDifferences : kPropertyDifferenceCount; |
153 unsigned m_scrollAnchorDisablingPropertyChanged : 1; | 159 unsigned m_scrollAnchorDisablingPropertyChanged : 1; |
154 }; | 160 }; |
155 | 161 |
| 162 CORE_EXPORT std::ostream& operator<<(std::ostream&, const StyleDifference&); |
| 163 |
156 } // namespace blink | 164 } // namespace blink |
157 | 165 |
158 #endif // StyleDifference_h | 166 #endif // StyleDifference_h |
OLD | NEW |