| 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 <iosfwd> | 8 #include <iosfwd> |
| 9 #include "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
| 10 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // The object needs to issue paint invalidations if it is affected by text | 26 // The object needs to issue paint invalidations if it is affected by text |
| 27 // decorations or properties dependent on color (e.g., border or outline). | 27 // decorations or properties dependent on color (e.g., border or outline). |
| 28 TextDecorationOrColorChanged = 1 << 6, | 28 TextDecorationOrColorChanged = 1 << 6, |
| 29 // If you add a value here, be sure to update kPropertyDifferenceCount. | 29 // If you add a value here, be sure to update kPropertyDifferenceCount. |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 StyleDifference() | 32 StyleDifference() |
| 33 : m_paintInvalidationType(NoPaintInvalidation), | 33 : m_paintInvalidationType(NoPaintInvalidation), |
| 34 m_layoutType(NoLayout), | 34 m_layoutType(NoLayout), |
| 35 m_recomputeOverflow(false), | 35 m_recomputeOverflow(false), |
| 36 m_visualRectUpdate(false), |
| 36 m_propertySpecificDifferences(0), | 37 m_propertySpecificDifferences(0), |
| 37 m_scrollAnchorDisablingPropertyChanged(false) {} | 38 m_scrollAnchorDisablingPropertyChanged(false) {} |
| 38 | 39 |
| 39 bool hasDifference() const { | 40 bool hasDifference() const { |
| 40 bool result = m_paintInvalidationType || m_layoutType || | 41 return m_paintInvalidationType || m_layoutType || |
| 41 m_propertySpecificDifferences; | 42 m_propertySpecificDifferences || m_recomputeOverflow || |
| 42 // m_recomputeOverflow, m_scrollAnchorDisablingPropertyChanged and | 43 m_visualRectUpdate || m_scrollAnchorDisablingPropertyChanged; |
| 43 // are never set without other flags set. | |
| 44 DCHECK(result || | |
| 45 (!m_recomputeOverflow && !m_scrollAnchorDisablingPropertyChanged)); | |
| 46 return result; | |
| 47 } | 44 } |
| 48 | 45 |
| 49 bool hasAtMostPropertySpecificDifferences( | 46 bool hasAtMostPropertySpecificDifferences( |
| 50 unsigned propertyDifferences) const { | 47 unsigned propertyDifferences) const { |
| 51 return !m_paintInvalidationType && !m_layoutType && | 48 return !m_paintInvalidationType && !m_layoutType && |
| 52 !(m_propertySpecificDifferences & ~propertyDifferences); | 49 !(m_propertySpecificDifferences & ~propertyDifferences); |
| 53 } | 50 } |
| 54 | 51 |
| 55 bool needsFullPaintInvalidation() const { | 52 bool needsFullPaintInvalidation() const { |
| 56 return m_paintInvalidationType != NoPaintInvalidation; | 53 return m_paintInvalidationType != NoPaintInvalidation; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 84 DCHECK(!needsFullLayout()); | 81 DCHECK(!needsFullLayout()); |
| 85 m_layoutType = PositionedMovement; | 82 m_layoutType = PositionedMovement; |
| 86 } | 83 } |
| 87 | 84 |
| 88 bool needsFullLayout() const { return m_layoutType == FullLayout; } | 85 bool needsFullLayout() const { return m_layoutType == FullLayout; } |
| 89 void setNeedsFullLayout() { m_layoutType = FullLayout; } | 86 void setNeedsFullLayout() { m_layoutType = FullLayout; } |
| 90 | 87 |
| 91 bool needsRecomputeOverflow() const { return m_recomputeOverflow; } | 88 bool needsRecomputeOverflow() const { return m_recomputeOverflow; } |
| 92 void setNeedsRecomputeOverflow() { m_recomputeOverflow = true; } | 89 void setNeedsRecomputeOverflow() { m_recomputeOverflow = true; } |
| 93 | 90 |
| 91 bool needsVisualRectUpdate() const { return m_visualRectUpdate; } |
| 92 void setNeedsVisualRectUpdate() { m_visualRectUpdate = true; } |
| 93 |
| 94 bool transformChanged() const { | 94 bool transformChanged() const { |
| 95 return m_propertySpecificDifferences & TransformChanged; | 95 return m_propertySpecificDifferences & TransformChanged; |
| 96 } | 96 } |
| 97 void setTransformChanged() { | 97 void setTransformChanged() { |
| 98 m_propertySpecificDifferences |= TransformChanged; | 98 m_propertySpecificDifferences |= TransformChanged; |
| 99 } | 99 } |
| 100 | 100 |
| 101 bool opacityChanged() const { | 101 bool opacityChanged() const { |
| 102 return m_propertySpecificDifferences & OpacityChanged; | 102 return m_propertySpecificDifferences & OpacityChanged; |
| 103 } | 103 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 enum PaintInvalidationType { | 148 enum PaintInvalidationType { |
| 149 NoPaintInvalidation, | 149 NoPaintInvalidation, |
| 150 PaintInvalidationObject, | 150 PaintInvalidationObject, |
| 151 PaintInvalidationSubtree, | 151 PaintInvalidationSubtree, |
| 152 }; | 152 }; |
| 153 unsigned m_paintInvalidationType : 2; | 153 unsigned m_paintInvalidationType : 2; |
| 154 | 154 |
| 155 enum LayoutType { NoLayout = 0, PositionedMovement, FullLayout }; | 155 enum LayoutType { NoLayout = 0, PositionedMovement, FullLayout }; |
| 156 unsigned m_layoutType : 2; | 156 unsigned m_layoutType : 2; |
| 157 unsigned m_recomputeOverflow : 1; | 157 unsigned m_recomputeOverflow : 1; |
| 158 unsigned m_visualRectUpdate : 1; |
| 158 unsigned m_propertySpecificDifferences : kPropertyDifferenceCount; | 159 unsigned m_propertySpecificDifferences : kPropertyDifferenceCount; |
| 159 unsigned m_scrollAnchorDisablingPropertyChanged : 1; | 160 unsigned m_scrollAnchorDisablingPropertyChanged : 1; |
| 160 }; | 161 }; |
| 161 | 162 |
| 162 CORE_EXPORT std::ostream& operator<<(std::ostream&, const StyleDifference&); | 163 CORE_EXPORT std::ostream& operator<<(std::ostream&, const StyleDifference&); |
| 163 | 164 |
| 164 } // namespace blink | 165 } // namespace blink |
| 165 | 166 |
| 166 #endif // StyleDifference_h | 167 #endif // StyleDifference_h |
| OLD | NEW |