| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 PaintInvalidator_h | 5 #ifndef PaintInvalidator_h |
| 6 #define PaintInvalidator_h | 6 #define PaintInvalidator_h |
| 7 | 7 |
| 8 #include "platform/geometry/LayoutRect.h" | 8 #include "platform/geometry/LayoutRect.h" |
| 9 #include "platform/graphics/paint/GeometryMapper.h" | |
| 10 #include "wtf/Vector.h" | 9 #include "wtf/Vector.h" |
| 11 | 10 |
| 12 namespace blink { | 11 namespace blink { |
| 13 | 12 |
| 14 class FrameView; | 13 class FrameView; |
| 15 class LayoutBoxModelObject; | 14 class LayoutBoxModelObject; |
| 16 class LayoutObject; | 15 class LayoutObject; |
| 17 class PaintLayer; | 16 class PaintLayer; |
| 18 struct PaintPropertyTreeBuilderContext; | 17 struct PaintPropertyTreeBuilderContext; |
| 19 | 18 |
| 20 struct PaintInvalidatorContext { | 19 struct PaintInvalidatorContext { |
| 21 PaintInvalidatorContext( | 20 PaintInvalidatorContext( |
| 22 const PaintPropertyTreeBuilderContext& treeBuilderContext, | 21 const PaintPropertyTreeBuilderContext& treeBuilderContext) |
| 23 GeometryMapper& geometryMapper) | 22 : parentContext(nullptr), m_treeBuilderContext(treeBuilderContext) {} |
| 24 : parentContext(nullptr), | |
| 25 m_treeBuilderContext(treeBuilderContext), | |
| 26 m_geometryMapper(geometryMapper) {} | |
| 27 | 23 |
| 28 PaintInvalidatorContext( | 24 PaintInvalidatorContext( |
| 29 const PaintPropertyTreeBuilderContext& treeBuilderContext, | 25 const PaintPropertyTreeBuilderContext& treeBuilderContext, |
| 30 const PaintInvalidatorContext& parentContext) | 26 const PaintInvalidatorContext& parentContext) |
| 31 : parentContext(&parentContext), | 27 : parentContext(&parentContext), |
| 32 forcedSubtreeInvalidationFlags( | 28 forcedSubtreeInvalidationFlags( |
| 33 parentContext.forcedSubtreeInvalidationFlags), | 29 parentContext.forcedSubtreeInvalidationFlags), |
| 34 paintInvalidationContainer(parentContext.paintInvalidationContainer), | 30 paintInvalidationContainer(parentContext.paintInvalidationContainer), |
| 35 paintInvalidationContainerForStackedContents( | 31 paintInvalidationContainerForStackedContents( |
| 36 parentContext.paintInvalidationContainerForStackedContents), | 32 parentContext.paintInvalidationContainerForStackedContents), |
| 37 paintingLayer(parentContext.paintingLayer), | 33 paintingLayer(parentContext.paintingLayer), |
| 38 m_treeBuilderContext(treeBuilderContext), | 34 m_treeBuilderContext(treeBuilderContext) {} |
| 39 m_geometryMapper(parentContext.m_geometryMapper) {} | |
| 40 | 35 |
| 41 // This method is virtual temporarily to adapt PaintInvalidatorContext and the | 36 // This method is virtual temporarily to adapt PaintInvalidatorContext and the |
| 42 // legacy PaintInvalidationState for code shared by old code and new code. | 37 // legacy PaintInvalidationState for code shared by old code and new code. |
| 43 virtual void mapLocalRectToVisualRectInBacking(const LayoutObject&, | 38 virtual void mapLocalRectToVisualRectInBacking(const LayoutObject&, |
| 44 LayoutRect&) const; | 39 LayoutRect&) const; |
| 45 | 40 |
| 46 const PaintInvalidatorContext* parentContext; | 41 const PaintInvalidatorContext* parentContext; |
| 47 | 42 |
| 48 enum ForcedSubtreeInvalidationFlag { | 43 enum ForcedSubtreeInvalidationFlag { |
| 49 ForcedSubtreeInvalidationChecking = 1 << 0, | 44 ForcedSubtreeInvalidationChecking = 1 << 0, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // invalidation backing's coordinates. They are used to detect layoutObject | 90 // invalidation backing's coordinates. They are used to detect layoutObject |
| 96 // shifts that force a full invalidation and invalidation check in subtree. | 91 // shifts that force a full invalidation and invalidation check in subtree. |
| 97 // The points do *not* account for composited scrolling. See | 92 // The points do *not* account for composited scrolling. See |
| 98 // LayoutObject::adjustVisualRectForCompositedScrolling(). | 93 // LayoutObject::adjustVisualRectForCompositedScrolling(). |
| 99 LayoutPoint oldLocation; | 94 LayoutPoint oldLocation; |
| 100 LayoutPoint newLocation; | 95 LayoutPoint newLocation; |
| 101 | 96 |
| 102 private: | 97 private: |
| 103 friend class PaintInvalidator; | 98 friend class PaintInvalidator; |
| 104 const PaintPropertyTreeBuilderContext& m_treeBuilderContext; | 99 const PaintPropertyTreeBuilderContext& m_treeBuilderContext; |
| 105 GeometryMapper& m_geometryMapper; | |
| 106 }; | 100 }; |
| 107 | 101 |
| 108 class PaintInvalidator { | 102 class PaintInvalidator { |
| 109 public: | 103 public: |
| 110 void invalidatePaintIfNeeded(FrameView&, PaintInvalidatorContext&); | 104 void invalidatePaintIfNeeded(FrameView&, PaintInvalidatorContext&); |
| 111 void invalidatePaintIfNeeded(const LayoutObject&, PaintInvalidatorContext&); | 105 void invalidatePaintIfNeeded(const LayoutObject&, PaintInvalidatorContext&); |
| 112 | 106 |
| 113 // Process objects needing paint invalidation on the next frame. | 107 // Process objects needing paint invalidation on the next frame. |
| 114 // See the definition of PaintInvalidationDelayedFull for more details. | 108 // See the definition of PaintInvalidationDelayedFull for more details. |
| 115 void processPendingDelayedPaintInvalidations(); | 109 void processPendingDelayedPaintInvalidations(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 133 PaintInvalidatorContext&); | 127 PaintInvalidatorContext&); |
| 134 ALWAYS_INLINE void updateVisualRect(const LayoutObject&, | 128 ALWAYS_INLINE void updateVisualRect(const LayoutObject&, |
| 135 PaintInvalidatorContext&); | 129 PaintInvalidatorContext&); |
| 136 | 130 |
| 137 Vector<const LayoutObject*> m_pendingDelayedPaintInvalidations; | 131 Vector<const LayoutObject*> m_pendingDelayedPaintInvalidations; |
| 138 }; | 132 }; |
| 139 | 133 |
| 140 } // namespace blink | 134 } // namespace blink |
| 141 | 135 |
| 142 #endif // PaintInvalidator_h | 136 #endif // PaintInvalidator_h |
| OLD | NEW |