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

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

Issue 2888253002: Skip both paint and raster invalidation for LayoutSVGHiddenContainer subtree (Closed)
Patch Set: 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 USING_FAST_MALLOC(PaintInvalidatorContext); 16 USING_FAST_MALLOC(PaintInvalidatorContext);
17 17
18 public: 18 public:
19 PaintInvalidatorContext() : parent_context(nullptr) {} 19 PaintInvalidatorContext() : parent_context(nullptr) {}
20 20
21 PaintInvalidatorContext(const PaintInvalidatorContext& parent_context) 21 PaintInvalidatorContext(const PaintInvalidatorContext& parent_context)
22 : parent_context(&parent_context), 22 : parent_context(&parent_context),
23 forced_subtree_invalidation_flags( 23 subtree_flags(parent_context.subtree_flags),
24 parent_context.forced_subtree_invalidation_flags),
25 paint_invalidation_container( 24 paint_invalidation_container(
26 parent_context.paint_invalidation_container), 25 parent_context.paint_invalidation_container),
27 paint_invalidation_container_for_stacked_contents( 26 paint_invalidation_container_for_stacked_contents(
28 parent_context.paint_invalidation_container_for_stacked_contents), 27 parent_context.paint_invalidation_container_for_stacked_contents),
29 painting_layer(parent_context.painting_layer) {} 28 painting_layer(parent_context.painting_layer) {}
30 29
31 // This method is virtual temporarily to adapt PaintInvalidatorContext and the 30 // This method is virtual temporarily to adapt PaintInvalidatorContext and the
32 // legacy PaintInvalidationState for code shared by old code and new code. 31 // legacy PaintInvalidationState for code shared by old code and new code.
33 virtual void MapLocalRectToVisualRectInBacking(const LayoutObject&, 32 virtual void MapLocalRectToVisualRectInBacking(const LayoutObject&,
34 LayoutRect&) const; 33 LayoutRect&) const;
35 34
36 bool NeedsVisualRectUpdate(const LayoutObject& object) const { 35 bool NeedsVisualRectUpdate(const LayoutObject& object) const {
37 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) 36 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
38 return true; 37 return true;
39 #if DCHECK_IS_ON() 38 #if DCHECK_IS_ON()
40 if (force_visual_rect_update_for_checking_) 39 if (force_visual_rect_update_for_checking_)
41 return true; 40 return true;
42 #endif 41 #endif
43 return object.NeedsPaintOffsetAndVisualRectUpdate() || 42 return object.NeedsPaintOffsetAndVisualRectUpdate() ||
44 (forced_subtree_invalidation_flags & 43 (subtree_flags & PaintInvalidatorContext::kSubtreeVisualRectUpdate);
45 PaintInvalidatorContext::kForcedSubtreeVisualRectUpdate);
46 } 44 }
47 45
48 const PaintInvalidatorContext* parent_context; 46 const PaintInvalidatorContext* parent_context;
49 47
50 enum ForcedSubtreeInvalidationFlag { 48 enum ForcedSubtreeInvalidationFlag {
fs 2017/05/18 08:52:41 Nit: Drop the 'Forced' suffix here as well?
fs 2017/05/18 08:53:29 Uhm, "prefix" is what I meant of course...
Xianzhu 2017/05/18 15:42:54 Done.
51 kForcedSubtreeInvalidationChecking = 1 << 0, 49 kSubtreeInvalidationChecking = 1 << 0,
52 kForcedSubtreeVisualRectUpdate = 1 << 1, 50 kSubtreeVisualRectUpdate = 1 << 1,
53 kForcedSubtreeFullInvalidation = 1 << 2, 51 kSubtreeFullInvalidation = 1 << 2,
54 kForcedSubtreeFullInvalidationForStackedContents = 1 << 3, 52 kSubtreeFullInvalidationForStackedContents = 1 << 3,
55 kForcedSubtreeSVGResourceChange = 1 << 4, 53 kSubtreeSVGResourceChange = 1 << 4,
56 54
57 // TODO(crbug.com/637313): This is temporary before we support filters in 55 // TODO(crbug.com/637313): This is temporary before we support filters in
58 // paint property tree. 56 // paint property tree.
59 kForcedSubtreeSlowPathRect = 1 << 5, 57 kSubtreeSlowPathRect = 1 << 5,
60 58
61 // The paint invalidation tree walk invalidates paint caches, such as 59 // When this flag is set, no paint or raster invalidation will be issued
62 // DisplayItemClients and subsequence caches, and also the regions 60 // for the subtree.
63 // into which objects raster pixels. When this flag is set, raster region
64 // invalidations are not issued.
65 // 61 //
66 // Context: some objects in this paint walk, for example SVG resource 62 // Context: some objects in this paint walk, for example SVG resource
67 // container subtress, don't actually have any raster regions, because they 63 // container subtrees, always paint onto temporary PaintControllers which
68 // are used as "painting subroutines" for one or more other locations in 64 // don't have cache, and don't actually have any raster regions, so they
69 // SVG. 65 // don't need any invalidation. They are used as "painting subroutines"
70 kForcedSubtreeNoRasterInvalidation = 1 << 6, 66 // for one or more other locations in SVG.
67 kSubtreeNoInvalidation = 1 << 6,
71 }; 68 };
72 unsigned forced_subtree_invalidation_flags = 0; 69 unsigned subtree_flags = 0;
73 70
74 // The following fields can be null only before 71 // The following fields can be null only before
75 // PaintInvalidator::updateContext(). 72 // PaintInvalidator::updateContext().
76 73
77 // The current paint invalidation container for normal flow objects. 74 // The current paint invalidation container for normal flow objects.
78 // It is the enclosing composited object. 75 // It is the enclosing composited object.
79 const LayoutBoxModelObject* paint_invalidation_container = nullptr; 76 const LayoutBoxModelObject* paint_invalidation_container = nullptr;
80 77
81 // The current paint invalidation container for stacked contents (stacking 78 // The current paint invalidation container for stacked contents (stacking
82 // contexts or positioned objects). It is the nearest ancestor composited 79 // contexts or positioned objects). It is the nearest ancestor composited
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 PaintInvalidatorContext&); 148 PaintInvalidatorContext&);
152 ALWAYS_INLINE void UpdateVisualRect(const LayoutObject&, 149 ALWAYS_INLINE void UpdateVisualRect(const LayoutObject&,
153 PaintInvalidatorContext&); 150 PaintInvalidatorContext&);
154 151
155 Vector<const LayoutObject*> pending_delayed_paint_invalidations_; 152 Vector<const LayoutObject*> pending_delayed_paint_invalidations_;
156 }; 153 };
157 154
158 } // namespace blink 155 } // namespace blink
159 156
160 #endif // PaintInvalidator_h 157 #endif // PaintInvalidator_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698