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

Side by Side Diff: third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp

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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "core/paint/PrePaintTreeWalk.h" 5 #include "core/paint/PrePaintTreeWalk.h"
6 6
7 #include "core/dom/DocumentLifecycle.h" 7 #include "core/dom/DocumentLifecycle.h"
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/frame/LocalFrame.h" 9 #include "core/frame/LocalFrame.h"
10 #include "core/layout/LayoutMultiColumnSpannerPlaceholder.h" 10 #include "core/layout/LayoutMultiColumnSpannerPlaceholder.h"
11 #include "core/layout/LayoutPart.h" 11 #include "core/layout/LayoutPart.h"
12 #include "core/layout/LayoutView.h" 12 #include "core/layout/LayoutView.h"
13 #include "core/paint/PaintLayer.h" 13 #include "core/paint/PaintLayer.h"
14 #include "platform/graphics/paint/GeometryMapper.h" 14 #include "platform/graphics/paint/GeometryMapper.h"
15 15
16 namespace blink { 16 namespace blink {
17 17
18 struct PrePaintTreeWalkContext { 18 struct PrePaintTreeWalkContext {
19 PrePaintTreeWalkContext() 19 PrePaintTreeWalkContext()
20 : tree_builder_context( 20 : tree_builder_context(
21 WTF::WrapUnique(new PaintPropertyTreeBuilderContext)), 21 WTF::WrapUnique(new PaintPropertyTreeBuilderContext)),
22 paint_invalidator_context(tree_builder_context.get()), 22 paint_invalidator_context(),
Xianzhu 2017/05/03 17:29:44 Nit: Remove the above line?
chrishtr 2017/05/03 18:04:35 Done.
23 ancestor_overflow_paint_layer(nullptr), 23 ancestor_overflow_paint_layer(nullptr),
24 ancestor_transformed_or_root_paint_layer(nullptr) {} 24 ancestor_transformed_or_root_paint_layer(nullptr) {}
25 25
26 PrePaintTreeWalkContext(const PrePaintTreeWalkContext& parent_context, 26 PrePaintTreeWalkContext(const PrePaintTreeWalkContext& parent_context,
27 bool needs_tree_builder_context) 27 bool needs_tree_builder_context)
28 : tree_builder_context( 28 : tree_builder_context(
29 WTF::WrapUnique(needs_tree_builder_context || DCHECK_IS_ON() 29 WTF::WrapUnique(needs_tree_builder_context || DCHECK_IS_ON()
30 ? new PaintPropertyTreeBuilderContext( 30 ? new PaintPropertyTreeBuilderContext(
31 *parent_context.tree_builder_context) 31 *parent_context.tree_builder_context)
32 : nullptr)), 32 : nullptr)),
33 paint_invalidator_context(tree_builder_context.get(), 33 paint_invalidator_context(parent_context.paint_invalidator_context),
34 parent_context.paint_invalidator_context),
35 ancestor_overflow_paint_layer( 34 ancestor_overflow_paint_layer(
36 parent_context.ancestor_overflow_paint_layer), 35 parent_context.ancestor_overflow_paint_layer),
37 ancestor_transformed_or_root_paint_layer( 36 ancestor_transformed_or_root_paint_layer(
38 parent_context.ancestor_transformed_or_root_paint_layer) { 37 parent_context.ancestor_transformed_or_root_paint_layer) {
39 #if DCHECK_IS_ON() 38 #if DCHECK_IS_ON()
40 if (needs_tree_builder_context) 39 if (needs_tree_builder_context)
41 DCHECK(parent_context.tree_builder_context->is_actually_needed); 40 DCHECK(parent_context.tree_builder_context->is_actually_needed);
42 tree_builder_context->is_actually_needed = needs_tree_builder_context; 41 tree_builder_context->is_actually_needed = needs_tree_builder_context;
43 #endif 42 #endif
44 } 43 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 this->NeedsTreeBuilderContextUpdate(frame_view, parent_context); 86 this->NeedsTreeBuilderContextUpdate(frame_view, parent_context);
88 PrePaintTreeWalkContext context(parent_context, 87 PrePaintTreeWalkContext context(parent_context,
89 needs_tree_builder_context_update); 88 needs_tree_builder_context_update);
90 // ancestorOverflowLayer does not cross frame boundaries. 89 // ancestorOverflowLayer does not cross frame boundaries.
91 context.ancestor_overflow_paint_layer = nullptr; 90 context.ancestor_overflow_paint_layer = nullptr;
92 if (context.tree_builder_context) { 91 if (context.tree_builder_context) {
93 property_tree_builder_.UpdateProperties(frame_view, 92 property_tree_builder_.UpdateProperties(frame_view,
94 *context.tree_builder_context); 93 *context.tree_builder_context);
95 } 94 }
96 paint_invalidator_.InvalidatePaint(frame_view, 95 paint_invalidator_.InvalidatePaint(frame_view,
96 context.tree_builder_context.get(),
97 context.paint_invalidator_context); 97 context.paint_invalidator_context);
98 98
99 if (LayoutView* view = frame_view.GetLayoutView()) { 99 if (LayoutView* view = frame_view.GetLayoutView()) {
100 Walk(*view, context); 100 Walk(*view, context);
101 #if DCHECK_IS_ON() 101 #if DCHECK_IS_ON()
102 view->AssertSubtreeClearedPaintInvalidationFlags(); 102 view->AssertSubtreeClearedPaintInvalidationFlags();
103 #endif 103 #endif
104 } 104 }
105 frame_view.ClearNeedsPaintPropertyUpdate(); 105 frame_view.ClearNeedsPaintPropertyUpdate();
106 } 106 }
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 // This must happen before updatePropertiesForSelf, because the latter reads 305 // This must happen before updatePropertiesForSelf, because the latter reads
306 // some of the state computed here. 306 // some of the state computed here.
307 UpdateAuxiliaryObjectProperties(object, context); 307 UpdateAuxiliaryObjectProperties(object, context);
308 308
309 if (context.tree_builder_context) { 309 if (context.tree_builder_context) {
310 DCHECK(context.tree_builder_context); 310 DCHECK(context.tree_builder_context);
311 property_tree_builder_.UpdatePropertiesForSelf( 311 property_tree_builder_.UpdatePropertiesForSelf(
312 object, *context.tree_builder_context); 312 object, *context.tree_builder_context);
313 } 313 }
314 314
315 paint_invalidator_.InvalidatePaint(object, context.paint_invalidator_context); 315 paint_invalidator_.InvalidatePaint(object, context.tree_builder_context.get(),
316 context.paint_invalidator_context);
316 317
317 if (context.tree_builder_context) { 318 if (context.tree_builder_context) {
318 property_tree_builder_.UpdatePropertiesForChildren( 319 property_tree_builder_.UpdatePropertiesForChildren(
319 object, *context.tree_builder_context); 320 object, *context.tree_builder_context);
320 InvalidatePaintLayerOptimizationsIfNeeded(object, context); 321 InvalidatePaintLayerOptimizationsIfNeeded(object, context);
321 } 322 }
322 323
323 for (const LayoutObject* child = object.SlowFirstChild(); child; 324 for (const LayoutObject* child = object.SlowFirstChild(); child;
324 child = child->NextSibling()) { 325 child = child->NextSibling()) {
325 if (child->IsLayoutMultiColumnSpannerPlaceholder()) { 326 if (child->IsLayoutMultiColumnSpannerPlaceholder()) {
(...skipping 17 matching lines...) Expand all
343 } 344 }
344 Walk(*frame_view, context); 345 Walk(*frame_view, context);
345 } 346 }
346 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281). 347 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281).
347 } 348 }
348 349
349 object.GetMutableForPainting().ClearPaintFlags(); 350 object.GetMutableForPainting().ClearPaintFlags();
350 } 351 }
351 352
352 } // namespace blink 353 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698