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 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class StyleDifference { | 13 class StyleDifference { |
14 STACK_ALLOCATED(); | 14 STACK_ALLOCATED(); |
15 public: | 15 public: |
16 enum PropertyDifference { | 16 enum PropertyDifference { |
17 TransformChanged = 1 << 0, | 17 TransformChanged = 1 << 0, |
18 OpacityChanged = 1 << 1, | 18 OpacityChanged = 1 << 1, |
19 ZIndexChanged = 1 << 2, | 19 ZIndexChanged = 1 << 2, |
20 FilterChanged = 1 << 3, | 20 FilterChanged = 1 << 3, |
21 BackdropFilterChanged = 1 << 4, | 21 BackdropFilterChanged = 1 << 4, |
22 // The object needs to issue paint invalidations if it is affected by te xt decorations or properties dependent on color (e.g., border or outline). | 22 // The object needs to issue paint invalidations if it is affected by te xt decorations or properties dependent on color (e.g., border or outline). |
23 TextDecorationOrColorChanged = 1 << 5, | 23 TextDecorationOrColorChanged = 1 << 5, |
24 // If you add a value here, be sure to update the number of bits on m_pr opertySpecificDifferences. | 24 // If you add a value here, be sure to update the number of bits on m_pr opertySpecificDifferences. |
25 VisualOverflowChanged = 1 << 6, | |
25 }; | 26 }; |
26 | 27 |
27 StyleDifference() | 28 StyleDifference() |
28 : m_paintInvalidationType(NoPaintInvalidation) | 29 : m_paintInvalidationType(NoPaintInvalidation) |
29 , m_layoutType(NoLayout) | 30 , m_layoutType(NoLayout) |
30 , m_propertySpecificDifferences(0) | 31 , m_propertySpecificDifferences(0) |
31 { } | 32 { } |
32 | 33 |
33 bool hasDifference() const { return m_paintInvalidationType || m_layoutType || m_propertySpecificDifferences; } | 34 bool hasDifference() const { return m_paintInvalidationType || m_layoutType || m_propertySpecificDifferences; } |
34 | 35 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 | 78 |
78 bool filterChanged() const { return m_propertySpecificDifferences & FilterCh anged; } | 79 bool filterChanged() const { return m_propertySpecificDifferences & FilterCh anged; } |
79 void setFilterChanged() { m_propertySpecificDifferences |= FilterChanged; } | 80 void setFilterChanged() { m_propertySpecificDifferences |= FilterChanged; } |
80 | 81 |
81 bool backdropFilterChanged() const { return m_propertySpecificDifferences & BackdropFilterChanged; } | 82 bool backdropFilterChanged() const { return m_propertySpecificDifferences & BackdropFilterChanged; } |
82 void setBackdropFilterChanged() { m_propertySpecificDifferences |= BackdropF ilterChanged; } | 83 void setBackdropFilterChanged() { m_propertySpecificDifferences |= BackdropF ilterChanged; } |
83 | 84 |
84 bool textDecorationOrColorChanged() const { return m_propertySpecificDiffere nces & TextDecorationOrColorChanged; } | 85 bool textDecorationOrColorChanged() const { return m_propertySpecificDiffere nces & TextDecorationOrColorChanged; } |
85 void setTextDecorationOrColorChanged() { m_propertySpecificDifferences |= Te xtDecorationOrColorChanged; } | 86 void setTextDecorationOrColorChanged() { m_propertySpecificDifferences |= Te xtDecorationOrColorChanged; } |
86 | 87 |
88 bool visualOverflowChanged() const { return m_propertySpecificDifferences & VisualOverflowChanged; } | |
89 void setVisualOverflowChanged() { m_propertySpecificDifferences |= VisualOve rflowChanged; } | |
Xianzhu
2016/03/23 20:28:26
I suggest to move this flag out of PropertyDiffere
| |
90 | |
87 private: | 91 private: |
88 enum PaintInvalidationType { | 92 enum PaintInvalidationType { |
89 NoPaintInvalidation = 0, | 93 NoPaintInvalidation = 0, |
90 PaintInvalidationObject, | 94 PaintInvalidationObject, |
91 PaintInvalidationLayer | 95 PaintInvalidationLayer |
92 }; | 96 }; |
93 unsigned m_paintInvalidationType : 2; | 97 unsigned m_paintInvalidationType : 2; |
94 | 98 |
95 enum LayoutType { | 99 enum LayoutType { |
96 NoLayout = 0, | 100 NoLayout = 0, |
97 PositionedMovement, | 101 PositionedMovement, |
98 FullLayout | 102 FullLayout |
99 }; | 103 }; |
100 unsigned m_layoutType : 2; | 104 unsigned m_layoutType : 2; |
101 | 105 |
102 unsigned m_propertySpecificDifferences : 6; | 106 unsigned m_propertySpecificDifferences : 7; |
103 }; | 107 }; |
104 | 108 |
105 } // namespace blink | 109 } // namespace blink |
106 | 110 |
107 #endif // StyleDifference_h | 111 #endif // StyleDifference_h |
OLD | NEW |