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 contains text or
properties dependent on color (e.g., border or outline). |
23 TextDecorationOrColorChanged = 1 << 5, | 23 TextOrColorChanged = 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 }; | 25 }; |
26 | 26 |
27 StyleDifference() | 27 StyleDifference() |
28 : m_paintInvalidationType(NoPaintInvalidation) | 28 : m_paintInvalidationType(NoPaintInvalidation) |
29 , m_layoutType(NoLayout) | 29 , m_layoutType(NoLayout) |
30 , m_propertySpecificDifferences(0) | 30 , m_propertySpecificDifferences(0) |
31 { } | 31 { } |
32 | 32 |
33 bool hasDifference() const { return m_paintInvalidationType || m_layoutType
|| m_propertySpecificDifferences; } | 33 bool hasDifference() const { return m_paintInvalidationType || m_layoutType
|| m_propertySpecificDifferences; } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 bool zIndexChanged() const { return m_propertySpecificDifferences & ZIndexCh
anged; } | 75 bool zIndexChanged() const { return m_propertySpecificDifferences & ZIndexCh
anged; } |
76 void setZIndexChanged() { m_propertySpecificDifferences |= ZIndexChanged; } | 76 void setZIndexChanged() { m_propertySpecificDifferences |= ZIndexChanged; } |
77 | 77 |
78 bool filterChanged() const { return m_propertySpecificDifferences & FilterCh
anged; } | 78 bool filterChanged() const { return m_propertySpecificDifferences & FilterCh
anged; } |
79 void setFilterChanged() { m_propertySpecificDifferences |= FilterChanged; } | 79 void setFilterChanged() { m_propertySpecificDifferences |= FilterChanged; } |
80 | 80 |
81 bool backdropFilterChanged() const { return m_propertySpecificDifferences &
BackdropFilterChanged; } | 81 bool backdropFilterChanged() const { return m_propertySpecificDifferences &
BackdropFilterChanged; } |
82 void setBackdropFilterChanged() { m_propertySpecificDifferences |= BackdropF
ilterChanged; } | 82 void setBackdropFilterChanged() { m_propertySpecificDifferences |= BackdropF
ilterChanged; } |
83 | 83 |
84 bool textDecorationOrColorChanged() const { return m_propertySpecificDiffere
nces & TextDecorationOrColorChanged; } | 84 bool textOrColorChanged() const { return m_propertySpecificDifferences & Tex
tOrColorChanged; } |
85 void setTextDecorationOrColorChanged() { m_propertySpecificDifferences |= Te
xtDecorationOrColorChanged; } | 85 void setTextOrColorChanged() { m_propertySpecificDifferences |= TextOrColorC
hanged; } |
86 | 86 |
87 private: | 87 private: |
88 enum PaintInvalidationType { | 88 enum PaintInvalidationType { |
89 NoPaintInvalidation = 0, | 89 NoPaintInvalidation = 0, |
90 PaintInvalidationObject, | 90 PaintInvalidationObject, |
91 PaintInvalidationLayer | 91 PaintInvalidationLayer |
92 }; | 92 }; |
93 unsigned m_paintInvalidationType : 2; | 93 unsigned m_paintInvalidationType : 2; |
94 | 94 |
95 enum LayoutType { | 95 enum LayoutType { |
96 NoLayout = 0, | 96 NoLayout = 0, |
97 PositionedMovement, | 97 PositionedMovement, |
98 FullLayout | 98 FullLayout |
99 }; | 99 }; |
100 unsigned m_layoutType : 2; | 100 unsigned m_layoutType : 2; |
101 | 101 |
102 unsigned m_propertySpecificDifferences : 6; | 102 unsigned m_propertySpecificDifferences : 6; |
103 }; | 103 }; |
104 | 104 |
105 } // namespace blink | 105 } // namespace blink |
106 | 106 |
107 #endif // StyleDifference_h | 107 #endif // StyleDifference_h |
OLD | NEW |