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

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

Issue 2247543003: Tweak priorities of paint invalidation reasons (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 ObjectPaintInvalidator_h 5 #ifndef ObjectPaintInvalidator_h
6 #define ObjectPaintInvalidator_h 6 #define ObjectPaintInvalidator_h
7 7
8 #include "platform/graphics/PaintInvalidationReason.h" 8 #include "platform/graphics/PaintInvalidationReason.h"
9 #include "wtf/Allocator.h" 9 #include "wtf/Allocator.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 class LayoutObject; 13 class LayoutObject;
14 class LayoutRect; 14 class LayoutRect;
15 struct PaintInvalidatorContext; 15 struct PaintInvalidatorContext;
16 16
17 class ObjectPaintInvalidator { 17 class ObjectPaintInvalidator {
18 STACK_ALLOCATED(); 18 STACK_ALLOCATED();
19 public: 19 public:
20 ObjectPaintInvalidator(const LayoutObject& object, const PaintInvalidatorCon text& context) 20 ObjectPaintInvalidator(const LayoutObject& object, const PaintInvalidatorCon text& context)
21 : m_object(object), m_context(context) { } 21 : m_object(object), m_context(context) { }
22 22
23 static void objectWillBeDestroyed(const LayoutObject&); 23 static void objectWillBeDestroyed(const LayoutObject&);
24 24
25 PaintInvalidationReason invalidatePaintIfNeeded() { return invalidatePaintIf NeededWithComputedReason(computePaintInvalidationReason()); } 25 PaintInvalidationReason invalidatePaintIfNeeded() { return invalidatePaintIf NeededWithComputedReason(computePaintInvalidationReason()); }
26 26
27 PaintInvalidationReason computePaintInvalidationReason(); 27 PaintInvalidationReason computePaintInvalidationReason();
28 PaintInvalidationReason invalidatePaintIfNeededWithComputedReason(PaintInval idationReason); 28 PaintInvalidationReason invalidatePaintIfNeededWithComputedReason(PaintInval idationReason);
29 29
30 private:
31 void invalidateSelectionIfNeeded(PaintInvalidationReason);
32
33 // This function tries to minimize the amount of invalidation generated by i nvalidating the "difference" between 30 // This function tries to minimize the amount of invalidation generated by i nvalidating the "difference" between
34 // |m_context.oldBounds| and |m_context.newBounds|. This means invalidating the union of the previous rectangles 31 // |m_context.oldBounds| and |m_context.newBounds|. This means invalidating the union of the previous rectangles
35 // but not their intersection. The use case is when an element only requires a paint invalidation (which means 32 // but not their intersection. The use case is when an element only requires a paint invalidation (which means
36 // that its content didn't change) and its bounds changed but its location d idn't. 33 // that its content didn't change) and its bounds changed but its location d idn't.
37 // If we don't meet the criteria for an incremental paint, the alternative i s a full paint invalidation. 34 // If we don't meet the criteria for an incremental paint, the alternative i s a full paint invalidation.
38 void incrementallyInvalidatePaint(); 35 // Returns true if any paint invalidation is done.
36 bool incrementallyInvalidatePaint();
37
38 private:
39 void invalidateSelectionIfNeeded(PaintInvalidationReason);
39 40
40 // This function generates a full invalidation, which means invalidating bot h |oldBounds| and |newBounds|. 41 // This function generates a full invalidation, which means invalidating bot h |oldBounds| and |newBounds|.
41 // This is the default choice when generating an invalidation, as it is alwa ys correct, albeit it may force some extra painting. 42 // This is the default choice when generating an invalidation, as it is alwa ys correct, albeit it may force some extra painting.
42 void fullyInvalidatePaint(PaintInvalidationReason, const LayoutRect& oldBoun ds, const LayoutRect& newBounds); 43 void fullyInvalidatePaint(PaintInvalidationReason, const LayoutRect& oldBoun ds, const LayoutRect& newBounds);
43 44
44 const LayoutObject& m_object; 45 const LayoutObject& m_object;
45 const PaintInvalidatorContext& m_context; 46 const PaintInvalidatorContext& m_context;
46 }; 47 };
47 48
48 } // namespace blink 49 } // namespace blink
49 50
50 #endif 51 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698