| 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 SKY_ENGINE_CORE_RENDERING_STYLE_STYLEDIFFERENCE_H_ | 5 #ifndef SKY_ENGINE_CORE_RENDERING_STYLE_STYLEDIFFERENCE_H_ |
| 6 #define SKY_ENGINE_CORE_RENDERING_STYLE_STYLEDIFFERENCE_H_ | 6 #define SKY_ENGINE_CORE_RENDERING_STYLE_STYLEDIFFERENCE_H_ |
| 7 | 7 |
| 8 #include "sky/engine/wtf/Assertions.h" | 8 #include "sky/engine/wtf/Assertions.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 class StyleDifference { | 12 class StyleDifference { |
| 13 public: | 13 public: |
| 14 enum PropertyDifference { | 14 enum PropertyDifference { |
| 15 TransformChanged = 1 << 0, | 15 TransformChanged = 1 << 0, |
| 16 OpacityChanged = 1 << 1, | 16 OpacityChanged = 1 << 1, |
| 17 ZIndexChanged = 1 << 2, | 17 ZIndexChanged = 1 << 2, |
| 18 FilterChanged = 1 << 3, | 18 FilterChanged = 1 << 3, |
| 19 }; | 19 }; |
| 20 | 20 |
| 21 StyleDifference() | 21 StyleDifference() |
| 22 : m_needsPaintInvalidation(false) | 22 : m_layoutType(NoLayout) |
| 23 , m_layoutType(NoLayout) | |
| 24 , m_propertySpecificDifferences(0) | 23 , m_propertySpecificDifferences(0) |
| 25 { } | 24 { } |
| 26 | 25 |
| 27 bool needsPaintInvalidation() const { return m_needsPaintInvalidation; } | |
| 28 void setNeedsPaintInvalidation() | |
| 29 { | |
| 30 m_needsPaintInvalidation = true; | |
| 31 } | |
| 32 | |
| 33 bool needsLayout() const { return m_layoutType != NoLayout; } | 26 bool needsLayout() const { return m_layoutType != NoLayout; } |
| 34 void clearNeedsLayout() { m_layoutType = NoLayout; } | 27 void clearNeedsLayout() { m_layoutType = NoLayout; } |
| 35 | 28 |
| 36 // The offset of this positioned object has been updated. | 29 // The offset of this positioned object has been updated. |
| 37 bool needsPositionedMovementLayout() const { return m_layoutType == Position
edMovement; } | 30 bool needsPositionedMovementLayout() const { return m_layoutType == Position
edMovement; } |
| 38 void setNeedsPositionedMovementLayout() | 31 void setNeedsPositionedMovementLayout() |
| 39 { | 32 { |
| 40 ASSERT(!needsFullLayout()); | 33 ASSERT(!needsFullLayout()); |
| 41 m_layoutType = PositionedMovement; | 34 m_layoutType = PositionedMovement; |
| 42 } | 35 } |
| 43 | 36 |
| 44 bool needsFullLayout() const { return m_layoutType == FullLayout; } | 37 bool needsFullLayout() const { return m_layoutType == FullLayout; } |
| 45 void setNeedsFullLayout() { m_layoutType = FullLayout; } | 38 void setNeedsFullLayout() { m_layoutType = FullLayout; } |
| 46 | 39 |
| 47 bool transformChanged() const { return m_propertySpecificDifferences & Trans
formChanged; } | 40 bool transformChanged() const { return m_propertySpecificDifferences & Trans
formChanged; } |
| 48 void setTransformChanged() { m_propertySpecificDifferences |= TransformChang
ed; } | 41 void setTransformChanged() { m_propertySpecificDifferences |= TransformChang
ed; } |
| 49 | 42 |
| 50 bool opacityChanged() const { return m_propertySpecificDifferences & Opacity
Changed; } | 43 bool opacityChanged() const { return m_propertySpecificDifferences & Opacity
Changed; } |
| 51 void setOpacityChanged() { m_propertySpecificDifferences |= OpacityChanged;
} | 44 void setOpacityChanged() { m_propertySpecificDifferences |= OpacityChanged;
} |
| 52 | 45 |
| 53 bool zIndexChanged() const { return m_propertySpecificDifferences & ZIndexCh
anged; } | 46 bool zIndexChanged() const { return m_propertySpecificDifferences & ZIndexCh
anged; } |
| 54 void setZIndexChanged() { m_propertySpecificDifferences |= ZIndexChanged; } | 47 void setZIndexChanged() { m_propertySpecificDifferences |= ZIndexChanged; } |
| 55 | 48 |
| 56 bool filterChanged() const { return m_propertySpecificDifferences & FilterCh
anged; } | 49 bool filterChanged() const { return m_propertySpecificDifferences & FilterCh
anged; } |
| 57 void setFilterChanged() { m_propertySpecificDifferences |= FilterChanged; } | 50 void setFilterChanged() { m_propertySpecificDifferences |= FilterChanged; } |
| 58 | 51 |
| 59 private: | 52 private: |
| 60 unsigned m_needsPaintInvalidation : 1; | |
| 61 | |
| 62 enum LayoutType { | 53 enum LayoutType { |
| 63 NoLayout = 0, | 54 NoLayout = 0, |
| 64 PositionedMovement, | 55 PositionedMovement, |
| 65 FullLayout | 56 FullLayout |
| 66 }; | 57 }; |
| 67 unsigned m_layoutType : 2; | 58 unsigned m_layoutType : 2; |
| 68 | 59 |
| 69 unsigned m_propertySpecificDifferences : 5; | 60 unsigned m_propertySpecificDifferences : 5; |
| 70 }; | 61 }; |
| 71 | 62 |
| 72 } // namespace blink | 63 } // namespace blink |
| 73 | 64 |
| 74 #endif // SKY_ENGINE_CORE_RENDERING_STYLE_STYLEDIFFERENCE_H_ | 65 #endif // SKY_ENGINE_CORE_RENDERING_STYLE_STYLEDIFFERENCE_H_ |
| OLD | NEW |