Chromium Code Reviews| 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 the number of bits on |
| 28 // m_propertySpecificDifferences. | 30 // m_propertySpecificDifferences. |
| 31 | |
| 32 PropertyDifferenceMax = TextDecorationOrColorChanged | |
| 29 }; | 33 }; |
| 30 | 34 |
| 31 StyleDifference() | 35 StyleDifference() |
| 32 : m_paintInvalidationType(NoPaintInvalidation), | 36 : m_paintInvalidationType(NoPaintInvalidation), |
| 33 m_layoutType(NoLayout), | 37 m_layoutType(NoLayout), |
| 34 m_recomputeOverflow(false), | 38 m_recomputeOverflow(false), |
| 35 m_propertySpecificDifferences(0), | 39 m_propertySpecificDifferences(0), |
| 36 m_scrollAnchorDisablingPropertyChanged(false) {} | 40 m_scrollAnchorDisablingPropertyChanged(false) {} |
| 37 | 41 |
| 38 bool hasDifference() const { | 42 bool hasDifference() const { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 } | 136 } |
| 133 | 137 |
| 134 bool scrollAnchorDisablingPropertyChanged() const { | 138 bool scrollAnchorDisablingPropertyChanged() const { |
| 135 return m_scrollAnchorDisablingPropertyChanged; | 139 return m_scrollAnchorDisablingPropertyChanged; |
| 136 } | 140 } |
| 137 void setScrollAnchorDisablingPropertyChanged() { | 141 void setScrollAnchorDisablingPropertyChanged() { |
| 138 m_scrollAnchorDisablingPropertyChanged = true; | 142 m_scrollAnchorDisablingPropertyChanged = true; |
| 139 } | 143 } |
| 140 | 144 |
| 141 private: | 145 private: |
| 146 friend std::ostream& operator<<(std::ostream&, 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 : 7; |
| 153 unsigned m_scrollAnchorDisablingPropertyChanged : 1; | 159 unsigned m_scrollAnchorDisablingPropertyChanged : 1; |
| 154 }; | 160 }; |
| 155 | 161 |
| 162 CORE_EXPORT std::ostream& operator<<(std::ostream&, const StyleDifference); | |
|
Xianzhu
2017/03/20 21:14:11
Nit: either 'const StyleDifference&' or 'StyleDiff
wkorman
2017/03/20 23:04:29
Done.
| |
| 163 | |
| 156 } // namespace blink | 164 } // namespace blink |
| 157 | 165 |
| 158 #endif // StyleDifference_h | 166 #endif // StyleDifference_h |
| OLD | NEW |