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