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