| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 return result; | 45 return result; |
| 46 } | 46 } |
| 47 | 47 |
| 48 bool hasAtMostPropertySpecificDifferences( | 48 bool hasAtMostPropertySpecificDifferences( |
| 49 unsigned propertyDifferences) const { | 49 unsigned propertyDifferences) const { |
| 50 return !m_paintInvalidationType && !m_layoutType && | 50 return !m_paintInvalidationType && !m_layoutType && |
| 51 !(m_propertySpecificDifferences & ~propertyDifferences); | 51 !(m_propertySpecificDifferences & ~propertyDifferences); |
| 52 } | 52 } |
| 53 | 53 |
| 54 bool needsFullPaintInvalidation() const { | 54 bool needsFullPaintInvalidation() const { |
| 55 return m_paintInvalidationType > PaintInvalidationSelectionOnly; | 55 return m_paintInvalidationType != NoPaintInvalidation; |
| 56 } | |
| 57 | |
| 58 // The text selection needs paint invalidation. | |
| 59 bool needsPaintInvalidationSelection() const { | |
| 60 return m_paintInvalidationType == PaintInvalidationSelectionOnly; | |
| 61 } | |
| 62 void setNeedsPaintInvalidationSelection() { | |
| 63 if (!needsFullPaintInvalidation()) | |
| 64 m_paintInvalidationType = PaintInvalidationSelectionOnly; | |
| 65 } | 56 } |
| 66 | 57 |
| 67 // The object just needs to issue paint invalidations. | 58 // The object just needs to issue paint invalidations. |
| 68 bool needsPaintInvalidationObject() const { | 59 bool needsPaintInvalidationObject() const { |
| 69 return m_paintInvalidationType == PaintInvalidationObject; | 60 return m_paintInvalidationType == PaintInvalidationObject; |
| 70 } | 61 } |
| 71 void setNeedsPaintInvalidationObject() { | 62 void setNeedsPaintInvalidationObject() { |
| 72 DCHECK(!needsPaintInvalidationSubtree()); | 63 DCHECK(!needsPaintInvalidationSubtree()); |
| 73 m_paintInvalidationType = PaintInvalidationObject; | 64 m_paintInvalidationType = PaintInvalidationObject; |
| 74 } | 65 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 bool scrollAnchorDisablingPropertyChanged() const { | 134 bool scrollAnchorDisablingPropertyChanged() const { |
| 144 return m_scrollAnchorDisablingPropertyChanged; | 135 return m_scrollAnchorDisablingPropertyChanged; |
| 145 } | 136 } |
| 146 void setScrollAnchorDisablingPropertyChanged() { | 137 void setScrollAnchorDisablingPropertyChanged() { |
| 147 m_scrollAnchorDisablingPropertyChanged = true; | 138 m_scrollAnchorDisablingPropertyChanged = true; |
| 148 } | 139 } |
| 149 | 140 |
| 150 private: | 141 private: |
| 151 enum PaintInvalidationType { | 142 enum PaintInvalidationType { |
| 152 NoPaintInvalidation, | 143 NoPaintInvalidation, |
| 153 PaintInvalidationSelectionOnly, | |
| 154 PaintInvalidationObject, | 144 PaintInvalidationObject, |
| 155 PaintInvalidationSubtree, | 145 PaintInvalidationSubtree, |
| 156 }; | 146 }; |
| 157 unsigned m_paintInvalidationType : 2; | 147 unsigned m_paintInvalidationType : 2; |
| 158 | 148 |
| 159 enum LayoutType { NoLayout = 0, PositionedMovement, FullLayout }; | 149 enum LayoutType { NoLayout = 0, PositionedMovement, FullLayout }; |
| 160 unsigned m_layoutType : 2; | 150 unsigned m_layoutType : 2; |
| 161 unsigned m_recomputeOverflow : 1; | 151 unsigned m_recomputeOverflow : 1; |
| 162 unsigned m_propertySpecificDifferences : 7; | 152 unsigned m_propertySpecificDifferences : 7; |
| 163 unsigned m_scrollAnchorDisablingPropertyChanged : 1; | 153 unsigned m_scrollAnchorDisablingPropertyChanged : 1; |
| 164 }; | 154 }; |
| 165 | 155 |
| 166 } // namespace blink | 156 } // namespace blink |
| 167 | 157 |
| 168 #endif // StyleDifference_h | 158 #endif // StyleDifference_h |
| OLD | NEW |