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

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

Issue 2208463003: First step of PaintInvalidator implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 years, 4 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/PaintInvalidationState.h" 8 #include "platform/geometry/LayoutRect.h"
9 #include "wtf/Optional.h"
10 #include "wtf/Vector.h" 9 #include "wtf/Vector.h"
11 10
12 namespace blink { 11 namespace blink {
13 12
14 class FrameView; 13 class FrameView;
14 class LayoutBoxModelObject;
15 class LayoutObject; 15 class LayoutObject;
16 class PaintLayer;
16 struct PaintPropertyTreeBuilderContext; 17 struct PaintPropertyTreeBuilderContext;
17 18
18 // TODO(wangxianzhu): Move applicable PaintInvalidationState code into PaintInva lidator. 19 struct PaintInvalidatorContext {
19 using PaintInvalidatorContext = PaintInvalidationState; 20 PaintInvalidatorContext(const PaintPropertyTreeBuilderContext& treeBuilderCo ntext)
21 : treeBuilderContext(treeBuilderContext) { }
22
23 PaintInvalidatorContext(const PaintPropertyTreeBuilderContext& treeBuilderCo ntext, const PaintInvalidatorContext& parentContext)
24 : treeBuilderContext(treeBuilderContext)
25 , paintInvalidationContainer(parentContext.paintInvalidationContainer)
26 , paintInvalidationContainerForStackedContents(parentContext.paintInvali dationContainerForStackedContents)
27 , paintingLayer(parentContext.paintingLayer)
28 { }
29
30 // This method is temporary to adapt PaintInvalidatorContext and the legacy PaintInvalidationState
31 // for code shared by old code and new code.
32 virtual void mapLocalRectToPaintInvalidationBacking(const LayoutObject&, Lay outRect&) const;
33
34 const PaintPropertyTreeBuilderContext& treeBuilderContext;
35
36 enum ForcedSubtreeInvalidationFlag {
37 ForcedSubtreeInvalidationChecking = 1 << 0,
38 ForcedSubtreeInvalidationRectUpdate = 1 << 1,
39 ForcedSubtreeFullInvalidation = 1 << 2,
40 ForcedSubtreeFullInvalidationForStackedContents = 1 << 3,
41 };
42 unsigned forcedSubtreeInvalidationFlags = 0;
43
44 // The following fields can be null only before PaintInvalidator::updateCont ext().
45
46 // The current paint invalidation container for normal flow objects.
47 // It is the enclosing composited object.
48 const LayoutBoxModelObject* paintInvalidationContainer = nullptr;
49
50 // The current paint invalidation container for stacked contents (stacking c ontexts or positioned objects).
51 // It is the nearest ancestor composited object which establishes a stacking context.
52 // See Source/core/paint/README.md ### PaintInvalidationState for details on how stacked contents'
53 // paint invalidation containers differ.
54 const LayoutBoxModelObject* paintInvalidationContainerForStackedContents = n ullptr;
55
56 PaintLayer* paintingLayer = nullptr;
57
58 LayoutRect oldBounds;
59 LayoutRect newBounds;
60 LayoutPoint oldLocation;
61 LayoutPoint newLocation;
62 };
20 63
21 class PaintInvalidator { 64 class PaintInvalidator {
22 public: 65 public:
23 // TODO(wangxianzhu): Avoid Optional<> by using copy-and-update pattern for PaintInvalidatorContext. 66 void invalidatePaintIfNeeded(FrameView&, PaintInvalidatorContext&);
24 void invalidatePaintIfNeeded(FrameView&, const PaintPropertyTreeBuilderConte xt&, Optional<PaintInvalidatorContext>&); 67 void invalidatePaintIfNeeded(const LayoutObject&, PaintInvalidatorContext&);
25 void invalidatePaintIfNeeded(const LayoutObject&, const PaintPropertyTreeBui lderContext&, const PaintInvalidatorContext&, Optional<PaintInvalidatorContext>& );
26 68
27 // Process objects needing paint invalidation on the next frame. 69 // Process objects needing paint invalidation on the next frame.
28 // See the definition of PaintInvalidationDelayedFull for more details. 70 // See the definition of PaintInvalidationDelayedFull for more details.
29 void processPendingDelayedPaintInvalidations(); 71 void processPendingDelayedPaintInvalidations();
30 72
31 private: 73 private:
32 Vector<const LayoutObject*> m_pendingDelayedPaintInvalidations; 74 Vector<const LayoutObject*> m_pendingDelayedPaintInvalidations;
33 }; 75 };
34 76
35 } // namespace blink 77 } // namespace blink
36 78
37 #endif // PaintInvalidator_h 79 #endif // PaintInvalidator_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698