| 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 }; | 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_recomputeOverflow(false) |
| 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 |
| 35 bool hasAtMostPropertySpecificDifferences(unsigned propertyDifferences) cons
t | 36 bool hasAtMostPropertySpecificDifferences(unsigned propertyDifferences) cons
t |
| 36 { | 37 { |
| 37 return !m_paintInvalidationType && !m_layoutType && !(m_propertySpecific
Differences & ~propertyDifferences); | 38 return !m_paintInvalidationType && !m_layoutType && !(m_propertySpecific
Differences & ~propertyDifferences); |
| 38 } | 39 } |
| 39 | 40 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 59 bool needsPositionedMovementLayout() const { return m_layoutType == Position
edMovement; } | 60 bool needsPositionedMovementLayout() const { return m_layoutType == Position
edMovement; } |
| 60 void setNeedsPositionedMovementLayout() | 61 void setNeedsPositionedMovementLayout() |
| 61 { | 62 { |
| 62 ASSERT(!needsFullLayout()); | 63 ASSERT(!needsFullLayout()); |
| 63 m_layoutType = PositionedMovement; | 64 m_layoutType = PositionedMovement; |
| 64 } | 65 } |
| 65 | 66 |
| 66 bool needsFullLayout() const { return m_layoutType == FullLayout; } | 67 bool needsFullLayout() const { return m_layoutType == FullLayout; } |
| 67 void setNeedsFullLayout() { m_layoutType = FullLayout; } | 68 void setNeedsFullLayout() { m_layoutType = FullLayout; } |
| 68 | 69 |
| 70 bool needsRecomputeOverflow() const { return m_recomputeOverflow; } |
| 71 void setNeedsRecomputeOverflow() { m_recomputeOverflow = true; } |
| 72 |
| 69 bool transformChanged() const { return m_propertySpecificDifferences & Trans
formChanged; } | 73 bool transformChanged() const { return m_propertySpecificDifferences & Trans
formChanged; } |
| 70 void setTransformChanged() { m_propertySpecificDifferences |= TransformChang
ed; } | 74 void setTransformChanged() { m_propertySpecificDifferences |= TransformChang
ed; } |
| 71 | 75 |
| 72 bool opacityChanged() const { return m_propertySpecificDifferences & Opacity
Changed; } | 76 bool opacityChanged() const { return m_propertySpecificDifferences & Opacity
Changed; } |
| 73 void setOpacityChanged() { m_propertySpecificDifferences |= OpacityChanged;
} | 77 void setOpacityChanged() { m_propertySpecificDifferences |= OpacityChanged;
} |
| 74 | 78 |
| 75 bool zIndexChanged() const { return m_propertySpecificDifferences & ZIndexCh
anged; } | 79 bool zIndexChanged() const { return m_propertySpecificDifferences & ZIndexCh
anged; } |
| 76 void setZIndexChanged() { m_propertySpecificDifferences |= ZIndexChanged; } | 80 void setZIndexChanged() { m_propertySpecificDifferences |= ZIndexChanged; } |
| 77 | 81 |
| 78 bool filterChanged() const { return m_propertySpecificDifferences & FilterCh
anged; } | 82 bool filterChanged() const { return m_propertySpecificDifferences & FilterCh
anged; } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 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 unsigned m_recomputeOverflow : 1; |
| 102 unsigned m_propertySpecificDifferences : 6; | 106 unsigned m_propertySpecificDifferences : 6; |
| 103 }; | 107 }; |
| 104 | 108 |
| 105 } // namespace blink | 109 } // namespace blink |
| 106 | 110 |
| 107 #endif // StyleDifference_h | 111 #endif // StyleDifference_h |
| OLD | NEW |