| 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" | 9 #include "platform/graphics/paint/GeometryMapper.h" |
| 10 #include "wtf/Vector.h" | 10 #include "wtf/Vector.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 PaintInvalidatorContext( | 25 PaintInvalidatorContext( |
| 26 const PaintPropertyTreeBuilderContext& treeBuilderContext, | 26 const PaintPropertyTreeBuilderContext& treeBuilderContext, |
| 27 const PaintInvalidatorContext& parentContext) | 27 const PaintInvalidatorContext& parentContext) |
| 28 : treeBuilderContext(treeBuilderContext), | 28 : treeBuilderContext(treeBuilderContext), |
| 29 forcedSubtreeInvalidationFlags( | 29 forcedSubtreeInvalidationFlags( |
| 30 parentContext.forcedSubtreeInvalidationFlags), | 30 parentContext.forcedSubtreeInvalidationFlags), |
| 31 paintInvalidationContainer(parentContext.paintInvalidationContainer), | 31 paintInvalidationContainer(parentContext.paintInvalidationContainer), |
| 32 paintInvalidationContainerForStackedContents( | 32 paintInvalidationContainerForStackedContents( |
| 33 parentContext.paintInvalidationContainerForStackedContents), | 33 parentContext.paintInvalidationContainerForStackedContents), |
| 34 paintingLayer(parentContext.paintingLayer) {} | 34 paintingLayer(parentContext.paintingLayer), |
| 35 shouldAdjustPaintOffsetToContainer( |
| 36 parentContext.shouldAdjustPaintOffsetToContainer), |
| 37 shouldAdjustPaintOffsetToContainerForStackedContents( |
| 38 parentContext |
| 39 .shouldAdjustPaintOffsetToContainerForStackedContents) {} |
| 35 | 40 |
| 36 // This method is temporary to adapt PaintInvalidatorContext and the legacy | 41 // This method is temporary to adapt PaintInvalidatorContext and the legacy |
| 37 // PaintInvalidationState for code shared by old code and new code. | 42 // PaintInvalidationState for code shared by old code and new code. |
| 38 virtual void mapLocalRectToPaintInvalidationBacking(const LayoutObject&, | 43 virtual void mapLocalRectToPaintInvalidationBacking(const LayoutObject&, |
| 39 LayoutRect&) const; | 44 LayoutRect&) const; |
| 40 | 45 |
| 41 const PaintPropertyTreeBuilderContext& treeBuilderContext; | 46 const PaintPropertyTreeBuilderContext& treeBuilderContext; |
| 42 | 47 |
| 43 enum ForcedSubtreeInvalidationFlag { | 48 enum ForcedSubtreeInvalidationFlag { |
| 44 ForcedSubtreeInvalidationChecking = 1 << 0, | 49 ForcedSubtreeInvalidationChecking = 1 << 0, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 62 // The current paint invalidation container for stacked contents (stacking | 67 // The current paint invalidation container for stacked contents (stacking |
| 63 // contexts or positioned objects). It is the nearest ancestor composited | 68 // contexts or positioned objects). It is the nearest ancestor composited |
| 64 // object which establishes a stacking context. See | 69 // object which establishes a stacking context. See |
| 65 // Source/core/paint/README.md ### PaintInvalidationState for details on how | 70 // Source/core/paint/README.md ### PaintInvalidationState for details on how |
| 66 // stacked contents' paint invalidation containers differ. | 71 // stacked contents' paint invalidation containers differ. |
| 67 const LayoutBoxModelObject* paintInvalidationContainerForStackedContents = | 72 const LayoutBoxModelObject* paintInvalidationContainerForStackedContents = |
| 68 nullptr; | 73 nullptr; |
| 69 | 74 |
| 70 PaintLayer* paintingLayer = nullptr; | 75 PaintLayer* paintingLayer = nullptr; |
| 71 | 76 |
| 72 // Store the new and old visual rects in the paint invalidation backing's | 77 // Store the old and new visual rects in the paint invalidation backing's |
| 73 // coordinates. The rects do *not* account for composited scrolling. | 78 // coordinates. The rects do *not* account for composited scrolling. |
| 74 // See LayoutObject::adjustVisualRectForCompositedScrolling(). | 79 // See LayoutObject::adjustVisualRectForCompositedScrolling(). |
| 75 LayoutRect oldVisualRect; | 80 LayoutRect oldVisualRect; |
| 76 LayoutRect newVisualRect; | 81 LayoutRect newVisualRect; |
| 77 | 82 |
| 78 // Store the origin of the object's local coordinates in the paint | 83 // Store the origin of the object's local coordinates in the paint |
| 79 // invalidation backing's coordinates. They are used to detect layoutObject | 84 // invalidation backing's coordinates. They are used to detect layoutObject |
| 80 // shifts that force a full invalidation and invalidation check in subtree. | 85 // shifts that force a full invalidation and invalidation check in subtree. |
| 81 // The points do *not* account for composited scrolling. See | 86 // The points do *not* account for composited scrolling. See |
| 82 // LayoutObject::adjustVisualRectForCompositedScrolling(). | 87 // LayoutObject::adjustVisualRectForCompositedScrolling(). |
| 83 LayoutPoint oldLocation; | 88 LayoutPoint oldLocation; |
| 84 LayoutPoint newLocation; | 89 LayoutPoint newLocation; |
| 90 |
| 91 // Stores the old and new offsets to paint this object, relative to the |
| 92 // containing transform node. |
| 93 LayoutPoint oldPaintOffset; |
| 94 LayoutPoint newPaintOffset; |
| 95 |
| 96 // PaintPropertyTreeBuilder computes paint offset relative to the containing |
| 97 // transform node. If the transform node is above paintInvalidationContainer, |
| 98 // we need to adjust paint offset into paintInvalidationContainer space. |
| 99 bool shouldAdjustPaintOffsetToContainer = false; |
| 100 bool shouldAdjustPaintOffsetToContainerForStackedContents = false; |
| 85 }; | 101 }; |
| 86 | 102 |
| 87 class PaintInvalidator { | 103 class PaintInvalidator { |
| 88 public: | 104 public: |
| 89 void invalidatePaintIfNeeded(FrameView&, PaintInvalidatorContext&); | 105 void invalidatePaintIfNeeded(FrameView&, PaintInvalidatorContext&); |
| 90 void invalidatePaintIfNeeded(const LayoutObject&, PaintInvalidatorContext&); | 106 void invalidatePaintIfNeeded(const LayoutObject&, PaintInvalidatorContext&); |
| 91 | 107 |
| 92 // Process objects needing paint invalidation on the next frame. | 108 // Process objects needing paint invalidation on the next frame. |
| 93 // See the definition of PaintInvalidationDelayedFull for more details. | 109 // See the definition of PaintInvalidationDelayedFull for more details. |
| 94 void processPendingDelayedPaintInvalidations(); | 110 void processPendingDelayedPaintInvalidations(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 105 void updatePaintingLayer(const LayoutObject&, PaintInvalidatorContext&); | 121 void updatePaintingLayer(const LayoutObject&, PaintInvalidatorContext&); |
| 106 void updateContext(const LayoutObject&, PaintInvalidatorContext&); | 122 void updateContext(const LayoutObject&, PaintInvalidatorContext&); |
| 107 | 123 |
| 108 Vector<const LayoutObject*> m_pendingDelayedPaintInvalidations; | 124 Vector<const LayoutObject*> m_pendingDelayedPaintInvalidations; |
| 109 GeometryMapper m_geometryMapper; | 125 GeometryMapper m_geometryMapper; |
| 110 }; | 126 }; |
| 111 | 127 |
| 112 } // namespace blink | 128 } // namespace blink |
| 113 | 129 |
| 114 #endif // PaintInvalidator_h | 130 #endif // PaintInvalidator_h |
| OLD | NEW |