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