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 PaintInvalidationRectInBacking { | |
21 LayoutRect rect; | |
22 // True if the rect have been expanded to whole pixels or be rotated, skewed, | |
23 // etc., so covers more pixels than the object covers. | |
24 bool coversExtraPixels = false; | |
25 }; | |
26 | |
27 struct PaintInvalidatorContext { | 20 struct PaintInvalidatorContext { |
28 PaintInvalidatorContext( | 21 PaintInvalidatorContext( |
29 const PaintPropertyTreeBuilderContext& treeBuilderContext) | 22 const PaintPropertyTreeBuilderContext& treeBuilderContext) |
30 : treeBuilderContext(treeBuilderContext) {} | 23 : treeBuilderContext(treeBuilderContext) {} |
31 | 24 |
32 PaintInvalidatorContext( | 25 PaintInvalidatorContext( |
33 const PaintPropertyTreeBuilderContext& treeBuilderContext, | 26 const PaintPropertyTreeBuilderContext& treeBuilderContext, |
34 const PaintInvalidatorContext& parentContext) | 27 const PaintInvalidatorContext& parentContext) |
35 : treeBuilderContext(treeBuilderContext), | 28 : treeBuilderContext(treeBuilderContext), |
36 forcedSubtreeInvalidationFlags( | 29 forcedSubtreeInvalidationFlags( |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // The current paint invalidation container for stacked contents (stacking | 61 // The current paint invalidation container for stacked contents (stacking |
69 // contexts or positioned objects). It is the nearest ancestor composited | 62 // contexts or positioned objects). It is the nearest ancestor composited |
70 // object which establishes a stacking context. See | 63 // object which establishes a stacking context. See |
71 // Source/core/paint/README.md ### PaintInvalidationState for details on how | 64 // Source/core/paint/README.md ### PaintInvalidationState for details on how |
72 // stacked contents' paint invalidation containers differ. | 65 // stacked contents' paint invalidation containers differ. |
73 const LayoutBoxModelObject* paintInvalidationContainerForStackedContents = | 66 const LayoutBoxModelObject* paintInvalidationContainerForStackedContents = |
74 nullptr; | 67 nullptr; |
75 | 68 |
76 PaintLayer* paintingLayer = nullptr; | 69 PaintLayer* paintingLayer = nullptr; |
77 | 70 |
78 PaintInvalidationRectInBacking oldBounds; | 71 LayoutRect oldBounds; |
79 PaintInvalidationRectInBacking newBounds; | 72 LayoutRect newBounds; |
80 LayoutPoint oldLocation; | 73 LayoutPoint oldLocation; |
81 LayoutPoint newLocation; | 74 LayoutPoint newLocation; |
82 }; | 75 }; |
83 | 76 |
84 class PaintInvalidator { | 77 class PaintInvalidator { |
85 public: | 78 public: |
86 void invalidatePaintIfNeeded(FrameView&, PaintInvalidatorContext&); | 79 void invalidatePaintIfNeeded(FrameView&, PaintInvalidatorContext&); |
87 void invalidatePaintIfNeeded(const LayoutObject&, PaintInvalidatorContext&); | 80 void invalidatePaintIfNeeded(const LayoutObject&, PaintInvalidatorContext&); |
88 | 81 |
89 // Process objects needing paint invalidation on the next frame. | 82 // Process objects needing paint invalidation on the next frame. |
90 // See the definition of PaintInvalidationDelayedFull for more details. | 83 // See the definition of PaintInvalidationDelayedFull for more details. |
91 void processPendingDelayedPaintInvalidations(); | 84 void processPendingDelayedPaintInvalidations(); |
92 | 85 |
93 private: | 86 private: |
94 PaintInvalidationRectInBacking mapLocalRectToPaintInvalidationBacking( | 87 LayoutRect mapLocalRectToPaintInvalidationBacking( |
95 const LayoutObject&, | 88 const LayoutObject&, |
96 const FloatRect&, | 89 const FloatRect&, |
97 const PaintInvalidatorContext&); | 90 const PaintInvalidatorContext&); |
98 PaintInvalidationRectInBacking computePaintInvalidationRectInBacking( | 91 LayoutRect computePaintInvalidationRectInBacking( |
99 const LayoutObject&, | 92 const LayoutObject&, |
100 const PaintInvalidatorContext&); | 93 const PaintInvalidatorContext&); |
101 LayoutPoint computeLocationFromPaintInvalidationBacking( | 94 LayoutPoint computeLocationFromPaintInvalidationBacking( |
102 const LayoutObject&, | 95 const LayoutObject&, |
103 const PaintInvalidatorContext&); | 96 const PaintInvalidatorContext&); |
104 void updatePaintingLayer(const LayoutObject&, PaintInvalidatorContext&); | 97 void updatePaintingLayer(const LayoutObject&, PaintInvalidatorContext&); |
105 void updateContext(const LayoutObject&, PaintInvalidatorContext&); | 98 void updateContext(const LayoutObject&, PaintInvalidatorContext&); |
106 | 99 |
107 Vector<const LayoutObject*> m_pendingDelayedPaintInvalidations; | 100 Vector<const LayoutObject*> m_pendingDelayedPaintInvalidations; |
108 GeometryMapper m_geometryMapper; | 101 GeometryMapper m_geometryMapper; |
109 }; | 102 }; |
110 | 103 |
111 } // namespace blink | 104 } // namespace blink |
112 | 105 |
113 #endif // PaintInvalidator_h | 106 #endif // PaintInvalidator_h |
OLD | NEW |