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

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

Issue 2854493002: Store previous painting clip rects on FragmentData. (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 #ifndef PrePaintTreeWalk_h 5 #ifndef PrePaintTreeWalk_h
6 #define PrePaintTreeWalk_h 6 #define PrePaintTreeWalk_h
7 7
8 #include "core/paint/ClipRect.h" 8 #include "core/paint/ClipRect.h"
9 #include "core/paint/PaintInvalidator.h" 9 #include "core/paint/PaintInvalidator.h"
10 #include "core/paint/PaintPropertyTreeBuilder.h" 10 #include "core/paint/PaintPropertyTreeBuilder.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 class FrameView; 14 class FrameView;
15 class LayoutObject; 15 class LayoutObject;
16 class PropertyTreeState; 16 class PropertyTreeState;
17 struct PrePaintTreeWalkContext; 17 struct PrePaintTreeWalkContext;
18 18
19 // This class walks the whole layout tree, beginning from the root FrameView, 19 // This class walks the whole layout tree, beginning from the root FrameView,
20 // across frame boundaries. Helper classes are called for each tree node to 20 // across frame boundaries. Helper classes are called for each tree node to
21 // perform actual actions. It expects to be invoked in InPrePaint phase. 21 // perform actual actions. It expects to be invoked in InPrePaint phase.
22 class PrePaintTreeWalk { 22 class CORE_EXPORT PrePaintTreeWalk {
23 public: 23 public:
24 PrePaintTreeWalk() {} 24 PrePaintTreeWalk() {}
25 void Walk(FrameView& root_frame); 25 void Walk(FrameView& root_frame);
26 26
27 private: 27 private:
28 void Walk(FrameView&, const PrePaintTreeWalkContext&); 28 void Walk(FrameView&, const PrePaintTreeWalkContext&);
29 void Walk(const LayoutObject&, const PrePaintTreeWalkContext&); 29 void Walk(const LayoutObject&, const PrePaintTreeWalkContext&);
30 30
31 // Invalidates paint-layer painting optimizations, such as subsequence caching 31 // Invalidates paint-layer painting optimizations, such as subsequence caching
32 // and empty paint phase optimizations if clips from the context have changed. 32 // and empty paint phase optimizations if clips from the context have changed.
33 ALWAYS_INLINE void InvalidatePaintLayerOptimizationsIfNeeded( 33 ALWAYS_INLINE void InvalidatePaintLayerOptimizationsIfNeeded(
34 const LayoutObject&, 34 const LayoutObject&,
35 PrePaintTreeWalkContext&); 35 PrePaintTreeWalkContext&);
36 36
37 // Returns true if we should force checking subtree invalidation flags.
38 ALWAYS_INLINE bool InvalidatePaintLayerOptimizationsForFragment(
39 const LayoutObject&,
40 const PaintLayer* ancestor_transformed_or_root_paint_layer,
41 const PaintPropertyTreeBuilderFragmentContext&,
42 FragmentData&);
43
37 // Returns the clip applied to children for the given containing block context 44 // Returns the clip applied to children for the given containing block context
38 // + effect, in the space of ancestorState adjusted by ancestorPaintOffset. 45 // + effect, in the space of ancestorState adjusted by ancestorPaintOffset.
39 ALWAYS_INLINE LayoutRect ComputeClipRectForContext( 46 ALWAYS_INLINE LayoutRect ComputeClipRectForContext(
40 const PaintPropertyTreeBuilderFragmentContext::ContainingBlockContext&, 47 const PaintPropertyTreeBuilderFragmentContext::ContainingBlockContext&,
41 const EffectPaintPropertyNode*, 48 const EffectPaintPropertyNode*,
42 const PropertyTreeState& ancestor_state, 49 const PropertyTreeState& ancestor_state,
43 const LayoutPoint& ancestor_paint_offset); 50 const LayoutPoint& ancestor_paint_offset);
44 51
45 bool ALWAYS_INLINE 52 bool ALWAYS_INLINE
46 NeedsTreeBuilderContextUpdate(const FrameView&, 53 NeedsTreeBuilderContextUpdate(const FrameView&,
47 const PrePaintTreeWalkContext&); 54 const PrePaintTreeWalkContext&);
48 bool ALWAYS_INLINE 55 bool ALWAYS_INLINE
49 NeedsTreeBuilderContextUpdate(const LayoutObject&, 56 NeedsTreeBuilderContextUpdate(const LayoutObject&,
50 const PrePaintTreeWalkContext&); 57 const PrePaintTreeWalkContext&);
51 58
59 static void ClearPreviousClipRectsForTesting(const LayoutObject&);
60
52 PaintPropertyTreeBuilder property_tree_builder_; 61 PaintPropertyTreeBuilder property_tree_builder_;
53 PaintInvalidator paint_invalidator_; 62 PaintInvalidator paint_invalidator_;
63
64 FRIEND_TEST_ALL_PREFIXES(PrePaintTreeWalkTest, ClipRects);
54 }; 65 };
55 66
56 } // namespace blink 67 } // namespace blink
57 68
58 #endif // PrePaintTreeWalk_h 69 #endif // PrePaintTreeWalk_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698