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" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class FrameView; | 14 class FrameView; |
15 class LayoutBoxModelObject; | 15 class LayoutBoxModelObject; |
16 class LayoutObject; | 16 class LayoutObject; |
17 class PaintLayer; | 17 class PaintLayer; |
18 struct PaintPropertyTreeBuilderContext; | 18 struct PaintPropertyTreeBuilderContext; |
19 | 19 |
20 struct PaintInvalidatorContext { | 20 struct PaintInvalidatorContext { |
21 PaintInvalidatorContext( | 21 PaintInvalidatorContext( |
22 const PaintPropertyTreeBuilderContext& treeBuilderContext) | 22 const PaintPropertyTreeBuilderContext& treeBuilderContext, |
23 : treeBuilderContext(treeBuilderContext), parentContext(nullptr) {} | 23 GeometryMapper& geometryMapper) |
| 24 : treeBuilderContext(treeBuilderContext), |
| 25 geometryMapper(geometryMapper), |
| 26 parentContext(nullptr) {} |
24 | 27 |
25 PaintInvalidatorContext( | 28 PaintInvalidatorContext( |
26 const PaintPropertyTreeBuilderContext& treeBuilderContext, | 29 const PaintPropertyTreeBuilderContext& treeBuilderContext, |
27 const PaintInvalidatorContext& parentContext) | 30 const PaintInvalidatorContext& parentContext) |
28 : treeBuilderContext(treeBuilderContext), | 31 : treeBuilderContext(treeBuilderContext), |
| 32 geometryMapper(parentContext.geometryMapper), |
29 parentContext(&parentContext), | 33 parentContext(&parentContext), |
30 forcedSubtreeInvalidationFlags( | 34 forcedSubtreeInvalidationFlags( |
31 parentContext.forcedSubtreeInvalidationFlags), | 35 parentContext.forcedSubtreeInvalidationFlags), |
32 paintInvalidationContainer(parentContext.paintInvalidationContainer), | 36 paintInvalidationContainer(parentContext.paintInvalidationContainer), |
33 paintInvalidationContainerForStackedContents( | 37 paintInvalidationContainerForStackedContents( |
34 parentContext.paintInvalidationContainerForStackedContents), | 38 parentContext.paintInvalidationContainerForStackedContents), |
35 paintingLayer(parentContext.paintingLayer) {} | 39 paintingLayer(parentContext.paintingLayer) {} |
36 | 40 |
37 // This method is temporary to adapt PaintInvalidatorContext and the legacy | 41 // This method is virtual temporarily to adapt PaintInvalidatorContext and the |
38 // PaintInvalidationState for code shared by old code and new code. | 42 // legacy PaintInvalidationState for code shared by old code and new code. |
39 virtual void mapLocalRectToVisualRectInBacking(const LayoutObject&, | 43 virtual void mapLocalRectToVisualRectInBacking(const LayoutObject&, |
40 LayoutRect&) const; | 44 LayoutRect&) const; |
41 | 45 |
42 const PaintPropertyTreeBuilderContext& treeBuilderContext; | 46 const PaintPropertyTreeBuilderContext& treeBuilderContext; |
| 47 GeometryMapper& geometryMapper; |
43 const PaintInvalidatorContext* parentContext; | 48 const PaintInvalidatorContext* parentContext; |
44 | 49 |
45 enum ForcedSubtreeInvalidationFlag { | 50 enum ForcedSubtreeInvalidationFlag { |
46 ForcedSubtreeInvalidationChecking = 1 << 0, | 51 ForcedSubtreeInvalidationChecking = 1 << 0, |
47 ForcedSubtreeInvalidationRectUpdate = 1 << 1, | 52 ForcedSubtreeInvalidationRectUpdate = 1 << 1, |
48 ForcedSubtreeFullInvalidation = 1 << 2, | 53 ForcedSubtreeFullInvalidation = 1 << 2, |
49 ForcedSubtreeFullInvalidationForStackedContents = 1 << 3, | 54 ForcedSubtreeFullInvalidationForStackedContents = 1 << 3, |
50 ForcedSubtreeSVGResourceChange = 1 << 4, | 55 ForcedSubtreeSVGResourceChange = 1 << 4, |
51 // TODO(crbug.com/637313): This is temporary before we support filters in | 56 // TODO(crbug.com/637313): This is temporary before we support filters in |
52 // paint property tree. | 57 // paint property tree. |
(...skipping 28 matching lines...) Expand all Loading... |
81 // invalidation backing's coordinates. They are used to detect layoutObject | 86 // invalidation backing's coordinates. They are used to detect layoutObject |
82 // shifts that force a full invalidation and invalidation check in subtree. | 87 // shifts that force a full invalidation and invalidation check in subtree. |
83 // The points do *not* account for composited scrolling. See | 88 // The points do *not* account for composited scrolling. See |
84 // LayoutObject::adjustVisualRectForCompositedScrolling(). | 89 // LayoutObject::adjustVisualRectForCompositedScrolling(). |
85 LayoutPoint oldLocation; | 90 LayoutPoint oldLocation; |
86 LayoutPoint newLocation; | 91 LayoutPoint newLocation; |
87 }; | 92 }; |
88 | 93 |
89 class PaintInvalidator { | 94 class PaintInvalidator { |
90 public: | 95 public: |
91 PaintInvalidator(GeometryMapper& geometryMapper) | |
92 : m_geometryMapper(geometryMapper) {} | |
93 | |
94 void invalidatePaintIfNeeded(FrameView&, PaintInvalidatorContext&); | 96 void invalidatePaintIfNeeded(FrameView&, PaintInvalidatorContext&); |
95 void invalidatePaintIfNeeded(const LayoutObject&, PaintInvalidatorContext&); | 97 void invalidatePaintIfNeeded(const LayoutObject&, PaintInvalidatorContext&); |
96 | 98 |
97 // Process objects needing paint invalidation on the next frame. | 99 // Process objects needing paint invalidation on the next frame. |
98 // See the definition of PaintInvalidationDelayedFull for more details. | 100 // See the definition of PaintInvalidationDelayedFull for more details. |
99 void processPendingDelayedPaintInvalidations(); | 101 void processPendingDelayedPaintInvalidations(); |
100 | 102 |
101 private: | 103 private: |
102 ALWAYS_INLINE LayoutRect | 104 ALWAYS_INLINE LayoutRect |
103 computeVisualRectInBacking(const LayoutObject&, | 105 computeVisualRectInBacking(const LayoutObject&, |
104 const PaintInvalidatorContext&); | 106 const PaintInvalidatorContext&); |
105 ALWAYS_INLINE LayoutPoint | 107 ALWAYS_INLINE LayoutPoint |
106 computeLocationInBacking(const LayoutObject&, const PaintInvalidatorContext&); | 108 computeLocationInBacking(const LayoutObject&, const PaintInvalidatorContext&); |
107 ALWAYS_INLINE void updatePaintingLayer(const LayoutObject&, | 109 ALWAYS_INLINE void updatePaintingLayer(const LayoutObject&, |
108 PaintInvalidatorContext&); | 110 PaintInvalidatorContext&); |
109 ALWAYS_INLINE void updatePaintInvalidationContainer(const LayoutObject&, | 111 ALWAYS_INLINE void updatePaintInvalidationContainer(const LayoutObject&, |
110 PaintInvalidatorContext&); | 112 PaintInvalidatorContext&); |
111 ALWAYS_INLINE void updateVisualRect(const LayoutObject&, | 113 ALWAYS_INLINE void updateVisualRect(const LayoutObject&, |
112 PaintInvalidatorContext&); | 114 PaintInvalidatorContext&); |
113 | 115 |
114 Vector<const LayoutObject*> m_pendingDelayedPaintInvalidations; | 116 Vector<const LayoutObject*> m_pendingDelayedPaintInvalidations; |
115 GeometryMapper& m_geometryMapper; | |
116 }; | 117 }; |
117 | 118 |
118 } // namespace blink | 119 } // namespace blink |
119 | 120 |
120 #endif // PaintInvalidator_h | 121 #endif // PaintInvalidator_h |
OLD | NEW |