| 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 "wtf/Allocator.h" | 8 #include "wtf/Allocator.h" |
| 9 #include "wtf/Assertions.h" | 9 #include "wtf/Assertions.h" |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 TextDecorationOrColorChanged = 1 << 6, | 26 TextDecorationOrColorChanged = 1 << 6, |
| 27 // If you add a value here, be sure to update the number of bits on | 27 // If you add a value here, be sure to update the number of bits on |
| 28 // m_propertySpecificDifferences. | 28 // m_propertySpecificDifferences. |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 StyleDifference() | 31 StyleDifference() |
| 32 : m_paintInvalidationType(NoPaintInvalidation), | 32 : m_paintInvalidationType(NoPaintInvalidation), |
| 33 m_layoutType(NoLayout), | 33 m_layoutType(NoLayout), |
| 34 m_recomputeOverflow(false), | 34 m_recomputeOverflow(false), |
| 35 m_propertySpecificDifferences(0), | 35 m_propertySpecificDifferences(0), |
| 36 m_scrollAnchorDisablingPropertyChanged(false), | 36 m_scrollAnchorDisablingPropertyChanged(false) {} |
| 37 m_needsPaintPropertyUpdate(false) {} | |
| 38 | 37 |
| 39 bool hasDifference() const { | 38 bool hasDifference() const { |
| 40 bool result = m_paintInvalidationType || m_layoutType || | 39 bool result = m_paintInvalidationType || m_layoutType || |
| 41 m_propertySpecificDifferences; | 40 m_propertySpecificDifferences; |
| 42 // m_recomputeOverflow, m_scrollAnchorDisablingPropertyChanged and | 41 // m_recomputeOverflow, m_scrollAnchorDisablingPropertyChanged and |
| 43 // m_needsPaintPropertyUpdate are never set without other flags set. | 42 // are never set without other flags set. |
| 44 DCHECK(result || | 43 DCHECK(result || |
| 45 (!m_recomputeOverflow && !m_scrollAnchorDisablingPropertyChanged && | 44 (!m_recomputeOverflow && !m_scrollAnchorDisablingPropertyChanged)); |
| 46 !m_needsPaintPropertyUpdate)); | |
| 47 return result; | 45 return result; |
| 48 } | 46 } |
| 49 | 47 |
| 50 bool hasAtMostPropertySpecificDifferences( | 48 bool hasAtMostPropertySpecificDifferences( |
| 51 unsigned propertyDifferences) const { | 49 unsigned propertyDifferences) const { |
| 52 return !m_paintInvalidationType && !m_layoutType && | 50 return !m_paintInvalidationType && !m_layoutType && |
| 53 !(m_propertySpecificDifferences & ~propertyDifferences); | 51 !(m_propertySpecificDifferences & ~propertyDifferences); |
| 54 } | 52 } |
| 55 | 53 |
| 56 bool needsPaintInvalidation() const { | 54 bool needsPaintInvalidation() const { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 m_propertySpecificDifferences |= TextDecorationOrColorChanged; | 131 m_propertySpecificDifferences |= TextDecorationOrColorChanged; |
| 134 } | 132 } |
| 135 | 133 |
| 136 bool scrollAnchorDisablingPropertyChanged() const { | 134 bool scrollAnchorDisablingPropertyChanged() const { |
| 137 return m_scrollAnchorDisablingPropertyChanged; | 135 return m_scrollAnchorDisablingPropertyChanged; |
| 138 } | 136 } |
| 139 void setScrollAnchorDisablingPropertyChanged() { | 137 void setScrollAnchorDisablingPropertyChanged() { |
| 140 m_scrollAnchorDisablingPropertyChanged = true; | 138 m_scrollAnchorDisablingPropertyChanged = true; |
| 141 } | 139 } |
| 142 | 140 |
| 143 bool needsPaintPropertyUpdate() const { return m_needsPaintPropertyUpdate; } | |
| 144 void setNeedsPaintPropertyUpdate() { m_needsPaintPropertyUpdate = true; } | |
| 145 | |
| 146 private: | 141 private: |
| 147 enum PaintInvalidationType { | 142 enum PaintInvalidationType { |
| 148 NoPaintInvalidation = 0, | 143 NoPaintInvalidation = 0, |
| 149 PaintInvalidationObject, | 144 PaintInvalidationObject, |
| 150 PaintInvalidationSubtree | 145 PaintInvalidationSubtree |
| 151 }; | 146 }; |
| 152 unsigned m_paintInvalidationType : 2; | 147 unsigned m_paintInvalidationType : 2; |
| 153 | 148 |
| 154 enum LayoutType { NoLayout = 0, PositionedMovement, FullLayout }; | 149 enum LayoutType { NoLayout = 0, PositionedMovement, FullLayout }; |
| 155 unsigned m_layoutType : 2; | 150 unsigned m_layoutType : 2; |
| 156 unsigned m_recomputeOverflow : 1; | 151 unsigned m_recomputeOverflow : 1; |
| 157 unsigned m_propertySpecificDifferences : 7; | 152 unsigned m_propertySpecificDifferences : 7; |
| 158 unsigned m_scrollAnchorDisablingPropertyChanged : 1; | 153 unsigned m_scrollAnchorDisablingPropertyChanged : 1; |
| 159 unsigned m_needsPaintPropertyUpdate : 1; | |
| 160 }; | 154 }; |
| 161 | 155 |
| 162 } // namespace blink | 156 } // namespace blink |
| 163 | 157 |
| 164 #endif // StyleDifference_h | 158 #endif // StyleDifference_h |
| OLD | NEW |