| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef StyleDifference_h | |
| 6 #define StyleDifference_h | |
| 7 | |
| 8 #include "wtf/Assertions.h" | |
| 9 | |
| 10 namespace blink { | |
| 11 | |
| 12 class StyleDifference { | |
| 13 public: | |
| 14 enum PropertyDifference { | |
| 15 TransformChanged = 1 << 0, | |
| 16 OpacityChanged = 1 << 1, | |
| 17 ZIndexChanged = 1 << 2, | |
| 18 FilterChanged = 1 << 3, | |
| 19 // The object needs to issue paint invalidations if it contains text or
properties dependent on color (e.g., border or outline). | |
| 20 TextOrColorChanged = 1 << 4, | |
| 21 }; | |
| 22 | |
| 23 StyleDifference() | |
| 24 : m_paintInvalidationType(NoPaintInvalidation) | |
| 25 , m_layoutType(NoLayout) | |
| 26 , m_propertySpecificDifferences(0) | |
| 27 { } | |
| 28 | |
| 29 bool hasDifference() const { return m_paintInvalidationType || m_layoutType
|| m_propertySpecificDifferences; } | |
| 30 | |
| 31 bool hasAtMostPropertySpecificDifferences(unsigned propertyDifferences) cons
t | |
| 32 { | |
| 33 return !m_paintInvalidationType && !m_layoutType && !(m_propertySpecific
Differences & ~propertyDifferences); | |
| 34 } | |
| 35 | |
| 36 bool needsPaintInvalidation() const { return m_paintInvalidationType != NoPa
intInvalidation; } | |
| 37 void clearNeedsPaintInvalidation() { m_paintInvalidationType = NoPaintInvali
dation; } | |
| 38 | |
| 39 // The object just needs to issue paint invalidations. | |
| 40 bool needsPaintInvalidationObject() const { return m_paintInvalidationType =
= PaintInvalidationObject; } | |
| 41 void setNeedsPaintInvalidationObject() | |
| 42 { | |
| 43 ASSERT(!needsPaintInvalidationLayer()); | |
| 44 m_paintInvalidationType = PaintInvalidationObject; | |
| 45 } | |
| 46 | |
| 47 // The layer and its descendant layers need to issue paint invalidations. | |
| 48 bool needsPaintInvalidationLayer() const { return m_paintInvalidationType ==
PaintInvalidationLayer; } | |
| 49 void setNeedsPaintInvalidationLayer() { m_paintInvalidationType = PaintInval
idationLayer; } | |
| 50 | |
| 51 bool needsLayout() const { return m_layoutType != NoLayout; } | |
| 52 void clearNeedsLayout() { m_layoutType = NoLayout; } | |
| 53 | |
| 54 // The offset of this positioned object has been updated. | |
| 55 bool needsPositionedMovementLayout() const { return m_layoutType == Position
edMovement; } | |
| 56 void setNeedsPositionedMovementLayout() | |
| 57 { | |
| 58 ASSERT(!needsFullLayout()); | |
| 59 m_layoutType = PositionedMovement; | |
| 60 } | |
| 61 | |
| 62 bool needsFullLayout() const { return m_layoutType == FullLayout; } | |
| 63 void setNeedsFullLayout() { m_layoutType = FullLayout; } | |
| 64 | |
| 65 bool transformChanged() const { return m_propertySpecificDifferences & Trans
formChanged; } | |
| 66 void setTransformChanged() { m_propertySpecificDifferences |= TransformChang
ed; } | |
| 67 | |
| 68 bool opacityChanged() const { return m_propertySpecificDifferences & Opacity
Changed; } | |
| 69 void setOpacityChanged() { m_propertySpecificDifferences |= OpacityChanged;
} | |
| 70 | |
| 71 bool zIndexChanged() const { return m_propertySpecificDifferences & ZIndexCh
anged; } | |
| 72 void setZIndexChanged() { m_propertySpecificDifferences |= ZIndexChanged; } | |
| 73 | |
| 74 bool filterChanged() const { return m_propertySpecificDifferences & FilterCh
anged; } | |
| 75 void setFilterChanged() { m_propertySpecificDifferences |= FilterChanged; } | |
| 76 | |
| 77 bool textOrColorChanged() const { return m_propertySpecificDifferences & Tex
tOrColorChanged; } | |
| 78 void setTextOrColorChanged() { m_propertySpecificDifferences |= TextOrColorC
hanged; } | |
| 79 | |
| 80 private: | |
| 81 enum PaintInvalidationType { | |
| 82 NoPaintInvalidation = 0, | |
| 83 PaintInvalidationObject, | |
| 84 PaintInvalidationLayer | |
| 85 }; | |
| 86 unsigned m_paintInvalidationType : 2; | |
| 87 | |
| 88 enum LayoutType { | |
| 89 NoLayout = 0, | |
| 90 PositionedMovement, | |
| 91 FullLayout | |
| 92 }; | |
| 93 unsigned m_layoutType : 2; | |
| 94 | |
| 95 unsigned m_propertySpecificDifferences : 5; | |
| 96 }; | |
| 97 | |
| 98 } // namespace blink | |
| 99 | |
| 100 #endif // StyleDifference_h | |
| OLD | NEW |