Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1140)

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintInvalidator.h

Issue 2858873002: [SPv2] Refactor PaintInvalidator to be multicol-ready. (Closed)
Patch Set: none Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "core/layout/LayoutObject.h" 8 #include "core/layout/LayoutObject.h"
9 #include "core/paint/PaintPropertyTreeBuilder.h" 9 #include "core/paint/PaintPropertyTreeBuilder.h"
10 #include "platform/geometry/LayoutRect.h" 10 #include "platform/geometry/LayoutRect.h"
11 #include "platform/wtf/Vector.h" 11 #include "platform/wtf/Vector.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 struct PaintInvalidatorContext { 15 struct PaintInvalidatorContext {
16 PaintInvalidatorContext( 16 PaintInvalidatorContext()
17 const PaintPropertyTreeBuilderContext* tree_builder_context) 17 : parent_context(nullptr),
18 : parent_context(nullptr), tree_builder_context_(tree_builder_context) {} 18 tree_builder_context_(nullptr)
19 #if DCHECK_IS_ON()
20 ,
21 tree_builder_context_actually_needed_(false)
22 #endif
23 {
24 }
19 25
20 PaintInvalidatorContext( 26 PaintInvalidatorContext(const PaintInvalidatorContext& parent_context)
21 const PaintPropertyTreeBuilderContext* tree_builder_context,
22 const PaintInvalidatorContext& parent_context)
23 : parent_context(&parent_context), 27 : parent_context(&parent_context),
24 forced_subtree_invalidation_flags( 28 forced_subtree_invalidation_flags(
25 parent_context.forced_subtree_invalidation_flags), 29 parent_context.forced_subtree_invalidation_flags),
26 paint_invalidation_container( 30 paint_invalidation_container(
27 parent_context.paint_invalidation_container), 31 parent_context.paint_invalidation_container),
28 paint_invalidation_container_for_stacked_contents( 32 paint_invalidation_container_for_stacked_contents(
29 parent_context.paint_invalidation_container_for_stacked_contents), 33 parent_context.paint_invalidation_container_for_stacked_contents),
30 painting_layer(parent_context.painting_layer), 34 painting_layer(parent_context.painting_layer),
31 tree_builder_context_(tree_builder_context) {} 35 tree_builder_context_(nullptr)
36 #if DCHECK_IS_ON()
37 ,
38 tree_builder_context_actually_needed_(false)
39 #endif
40 {
41 }
32 42
33 // This method is virtual temporarily to adapt PaintInvalidatorContext and the 43 // This method is virtual temporarily to adapt PaintInvalidatorContext and the
34 // legacy PaintInvalidationState for code shared by old code and new code. 44 // legacy PaintInvalidationState for code shared by old code and new code.
35 virtual void MapLocalRectToVisualRectInBacking(const LayoutObject&, 45 virtual void MapLocalRectToVisualRectInBacking(const LayoutObject&,
36 LayoutRect&) const; 46 LayoutRect&) const;
37 47
38 bool NeedsVisualRectUpdate(const LayoutObject& object) const { 48 bool NeedsVisualRectUpdate(const LayoutObject& object) const {
39 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) 49 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
40 return true; 50 return true;
41 #if DCHECK_IS_ON() 51 #if DCHECK_IS_ON()
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // Store the origin of the object's local coordinates in the paint 109 // Store the origin of the object's local coordinates in the paint
100 // invalidation backing's coordinates. They are used to detect layoutObject 110 // invalidation backing's coordinates. They are used to detect layoutObject
101 // shifts that force a full invalidation and invalidation check in subtree. 111 // shifts that force a full invalidation and invalidation check in subtree.
102 // The points do *not* account for composited scrolling. See 112 // The points do *not* account for composited scrolling. See
103 // LayoutObject::adjustVisualRectForCompositedScrolling(). 113 // LayoutObject::adjustVisualRectForCompositedScrolling().
104 LayoutPoint old_location; 114 LayoutPoint old_location;
105 LayoutPoint new_location; 115 LayoutPoint new_location;
106 116
107 private: 117 private:
108 friend class PaintInvalidator; 118 friend class PaintInvalidator;
109 const PaintPropertyTreeBuilderContext* tree_builder_context_; 119 const PaintPropertyTreeBuilderFragmentContext* tree_builder_context_;
Xianzhu 2017/05/03 17:29:44 How about "= nullptr" to avoid changes in construc
chrishtr 2017/05/03 18:04:35 Done.
110 120
111 #if DCHECK_IS_ON() 121 #if DCHECK_IS_ON()
122 bool tree_builder_context_actually_needed_;
Xianzhu 2017/05/03 17:29:43 How about "= false" to avoid changes in constructo
chrishtr 2017/05/03 18:04:35 Done.
123 friend class FindVisualRectNeedingUpdateScope;
112 friend class FindVisualRectNeedingUpdateScopeBase; 124 friend class FindVisualRectNeedingUpdateScopeBase;
113 mutable bool force_visual_rect_update_for_checking_ = false; 125 mutable bool force_visual_rect_update_for_checking_ = false;
114 #endif 126 #endif
115 }; 127 };
116 128
117 class PaintInvalidator { 129 class PaintInvalidator {
118 public: 130 public:
119 void InvalidatePaint(FrameView&, PaintInvalidatorContext&); 131 void InvalidatePaint(FrameView&,
120 void InvalidatePaint(const LayoutObject&, PaintInvalidatorContext&); 132 const PaintPropertyTreeBuilderContext*,
133 PaintInvalidatorContext&);
134 void InvalidatePaint(const LayoutObject&,
135 const PaintPropertyTreeBuilderContext*,
136 PaintInvalidatorContext&);
121 137
122 // Process objects needing paint invalidation on the next frame. 138 // Process objects needing paint invalidation on the next frame.
123 // See the definition of PaintInvalidationDelayedFull for more details. 139 // See the definition of PaintInvalidationDelayedFull for more details.
124 void ProcessPendingDelayedPaintInvalidations(); 140 void ProcessPendingDelayedPaintInvalidations();
125 141
126 private: 142 private:
127 friend struct PaintInvalidatorContext; 143 friend struct PaintInvalidatorContext;
128 template <typename Rect, typename Point> 144 template <typename Rect, typename Point>
129 static LayoutRect MapLocalRectToVisualRectInBacking( 145 static LayoutRect MapLocalRectToVisualRectInBacking(
130 const LayoutObject&, 146 const LayoutObject&,
131 const Rect&, 147 const Rect&,
132 const PaintInvalidatorContext&); 148 const PaintInvalidatorContext&);
133 149
134 ALWAYS_INLINE LayoutRect 150 ALWAYS_INLINE LayoutRect
135 ComputeVisualRectInBacking(const LayoutObject&, 151 ComputeVisualRectInBacking(const LayoutObject&,
136 const PaintInvalidatorContext&); 152 const PaintInvalidatorContext&);
137 ALWAYS_INLINE LayoutPoint 153 ALWAYS_INLINE LayoutPoint
138 ComputeLocationInBacking(const LayoutObject&, const PaintInvalidatorContext&); 154 ComputeLocationInBacking(const LayoutObject&, const PaintInvalidatorContext&);
139 ALWAYS_INLINE void UpdatePaintingLayer(const LayoutObject&, 155 ALWAYS_INLINE void UpdatePaintingLayer(const LayoutObject&,
140 PaintInvalidatorContext&); 156 PaintInvalidatorContext&);
141 ALWAYS_INLINE void UpdatePaintInvalidationContainer(const LayoutObject&, 157 ALWAYS_INLINE void UpdatePaintInvalidationContainer(const LayoutObject&,
142 PaintInvalidatorContext&); 158 PaintInvalidatorContext&);
143 ALWAYS_INLINE void UpdateVisualRectIfNeeded(const LayoutObject&, 159 ALWAYS_INLINE void UpdateVisualRectIfNeeded(
144 PaintInvalidatorContext&); 160 const LayoutObject&,
161 const PaintPropertyTreeBuilderContext*,
162 PaintInvalidatorContext&);
145 ALWAYS_INLINE void UpdateVisualRect(const LayoutObject&, 163 ALWAYS_INLINE void UpdateVisualRect(const LayoutObject&,
146 PaintInvalidatorContext&); 164 PaintInvalidatorContext&);
147 165
148 Vector<const LayoutObject*> pending_delayed_paint_invalidations_; 166 Vector<const LayoutObject*> pending_delayed_paint_invalidations_;
149 }; 167 };
150 168
151 } // namespace blink 169 } // namespace blink
152 170
153 #endif // PaintInvalidator_h 171 #endif // PaintInvalidator_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698