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

Side by Side Diff: third_party/WebKit/Source/core/layout/PaintInvalidationState.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 PaintInvalidationState_h 5 #ifndef PaintInvalidationState_h
6 #define PaintInvalidationState_h 6 #define PaintInvalidationState_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/paint/PaintInvalidator.h"
9 #include "platform/geometry/LayoutRect.h" 10 #include "platform/geometry/LayoutRect.h"
10 #include "platform/graphics/PaintInvalidationReason.h" 11 #include "platform/graphics/PaintInvalidationReason.h"
11 #include "platform/transforms/AffineTransform.h" 12 #include "platform/transforms/AffineTransform.h"
12 #include "wtf/Allocator.h" 13 #include "wtf/Allocator.h"
13 #include "wtf/Noncopyable.h" 14 #include "wtf/Noncopyable.h"
14 15
15 namespace blink { 16 namespace blink {
16 17
17 class LayoutBoxModelObject; 18 class LayoutBoxModelObject;
18 class LayoutObject; 19 class LayoutObject;
(...skipping 30 matching lines...) Expand all
49 PaintInvalidationState(const LayoutView&, Vector<const LayoutObject*>& pendi ngDelayedPaintInvalidations); 50 PaintInvalidationState(const LayoutView&, Vector<const LayoutObject*>& pendi ngDelayedPaintInvalidations);
50 51
51 // When a PaintInvalidationState is constructed, it can be used to map point s/rects in the object's 52 // When a PaintInvalidationState is constructed, it can be used to map point s/rects in the object's
52 // local space (border box space for LayoutBoxes). After invalidation of the current object, 53 // local space (border box space for LayoutBoxes). After invalidation of the current object,
53 // before invalidation of the subtrees, this method must be called to apply clip and scroll offset 54 // before invalidation of the subtrees, this method must be called to apply clip and scroll offset
54 // etc. for creating child PaintInvalidationStates. 55 // etc. for creating child PaintInvalidationStates.
55 void updateForChildren(PaintInvalidationReason); 56 void updateForChildren(PaintInvalidationReason);
56 57
57 bool hasForcedSubtreeInvalidationFlags() const { return m_forcedSubtreeInval idationFlags; } 58 bool hasForcedSubtreeInvalidationFlags() const { return m_forcedSubtreeInval idationFlags; }
58 59
59 bool forcedSubtreeInvalidationCheckingWithinContainer() const { return m_for cedSubtreeInvalidationFlags & InvalidationChecking; } 60 bool forcedSubtreeInvalidationCheckingWithinContainer() const { return m_for cedSubtreeInvalidationFlags & PaintInvalidatorContext::ForcedSubtreeInvalidation Checking; }
60 void setForceSubtreeInvalidationCheckingWithinContainer() { m_forcedSubtreeI nvalidationFlags |= InvalidationChecking; } 61 void setForceSubtreeInvalidationCheckingWithinContainer() { m_forcedSubtreeI nvalidationFlags |= PaintInvalidatorContext::ForcedSubtreeInvalidationChecking; }
61 62
62 bool forcedSubtreeFullInvalidationWithinContainer() const { return m_forcedS ubtreeInvalidationFlags & FullInvalidation; } 63 bool forcedSubtreeFullInvalidationWithinContainer() const { return m_forcedS ubtreeInvalidationFlags & PaintInvalidatorContext::ForcedSubtreeFullInvalidation ; }
63 64
64 bool forcedSubtreeInvalidationRectUpdateWithinContainerOnly() const { return m_forcedSubtreeInvalidationFlags == InvalidationRectUpdate; } 65 bool forcedSubtreeInvalidationRectUpdateWithinContainerOnly() const { return m_forcedSubtreeInvalidationFlags == PaintInvalidatorContext::ForcedSubtreeInval idationRectUpdate; }
65 void setForceSubtreeInvalidationRectUpdateWithinContainer() { m_forcedSubtre eInvalidationFlags |= InvalidationRectUpdate; } 66 void setForceSubtreeInvalidationRectUpdateWithinContainer() { m_forcedSubtre eInvalidationFlags |= PaintInvalidatorContext::ForcedSubtreeInvalidationRectUpda te; }
66 67
67 const LayoutBoxModelObject& paintInvalidationContainer() const { return *m_p aintInvalidationContainer; } 68 const LayoutBoxModelObject& paintInvalidationContainer() const { return *m_p aintInvalidationContainer; }
68 69
69 // Computes the position of the current object ((0,0) in the space of the ob ject) 70 // Computes the position of the current object ((0,0) in the space of the ob ject)
70 // in the space of paint invalidation backing. 71 // in the space of paint invalidation backing.
71 LayoutPoint computePositionFromPaintInvalidationBacking() const; 72 LayoutPoint computePositionFromPaintInvalidationBacking() const;
72 73
73 // Returns the rect bounds needed to invalidate paint of this object, 74 // Returns the rect bounds needed to invalidate paint of this object,
74 // in the space of paint invalidation backing. 75 // in the space of paint invalidation backing.
75 LayoutRect computePaintInvalidationRectInBacking() const; 76 LayoutRect computePaintInvalidationRectInBacking() const;
76 77
77 void mapLocalRectToPaintInvalidationBacking(LayoutRect&) const; 78 void mapLocalRectToPaintInvalidationBacking(LayoutRect&) const;
78 79
79 PaintLayer& paintingLayer() const; 80 PaintLayer& paintingLayer() const;
80 81
81 #if ENABLE(ASSERT)
82 const LayoutObject& currentObject() const { return m_currentObject; } 82 const LayoutObject& currentObject() const { return m_currentObject; }
83 #endif
84 83
85 private: 84 private:
86 friend class VisualRectMappingTest; 85 friend class VisualRectMappingTest;
86 friend class PaintInvalidatorContextAdapter;
87 87
88 void mapLocalRectToPaintInvalidationContainer(LayoutRect&) const; 88 void mapLocalRectToPaintInvalidationContainer(LayoutRect&) const;
89 89
90 void updateForCurrentObject(const PaintInvalidationState& parentState); 90 void updateForCurrentObject(const PaintInvalidationState& parentState);
91 void updateForNormalChildren(); 91 void updateForNormalChildren();
92 92
93 LayoutRect computePaintInvalidationRectInBackingForSVG() const; 93 LayoutRect computePaintInvalidationRectInBackingForSVG() const;
94 94
95 void addClipRectRelativeToPaintOffset(const LayoutRect& localClipRect); 95 void addClipRectRelativeToPaintOffset(const LayoutRect& localClipRect);
96 96
97 const LayoutObject& m_currentObject; 97 const LayoutObject& m_currentObject;
98 98
99 enum ForcedSubtreeInvalidationFlag {
100 InvalidationChecking = 1 << 0,
101 InvalidationRectUpdate = 1 << 1,
102 FullInvalidation = 1 << 2,
103 FullInvalidationForStackedContents = 1 << 3,
104 };
105 unsigned m_forcedSubtreeInvalidationFlags; 99 unsigned m_forcedSubtreeInvalidationFlags;
106 100
107 bool m_clipped; 101 bool m_clipped;
108 bool m_clippedForAbsolutePosition; 102 bool m_clippedForAbsolutePosition;
109 103
110 // Clip rect from paintInvalidationContainer if m_cachedOffsetsEnabled is tr ue. 104 // Clip rect from paintInvalidationContainer if m_cachedOffsetsEnabled is tr ue.
111 LayoutRect m_clipRect; 105 LayoutRect m_clipRect;
112 LayoutRect m_clipRectForAbsolutePosition; 106 LayoutRect m_clipRectForAbsolutePosition;
113 107
114 // x/y offset from the paintInvalidationContainer if m_cachedOffsetsEnabled is true. 108 // x/y offset from the paintInvalidationContainer if m_cachedOffsetsEnabled is true.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 #if ENABLE(ASSERT) && !defined(NDEBUG) 147 #if ENABLE(ASSERT) && !defined(NDEBUG)
154 // #define CHECK_FAST_PATH_SLOW_PATH_EQUALITY 148 // #define CHECK_FAST_PATH_SLOW_PATH_EQUALITY
155 #endif 149 #endif
156 150
157 #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY 151 #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY
158 void assertFastPathAndSlowPathRectsEqual(const LayoutRect& fastPathRect, con st LayoutRect& slowPathRect) const; 152 void assertFastPathAndSlowPathRectsEqual(const LayoutRect& fastPathRect, con st LayoutRect& slowPathRect) const;
159 bool m_canCheckFastPathSlowPathEquality; 153 bool m_canCheckFastPathSlowPathEquality;
160 #endif 154 #endif
161 }; 155 };
162 156
157 // This is temporary to adapt legacy PaintInvalidationState to PaintInvalidatorC ontext
158 class PaintInvalidatorContextAdapter : public PaintInvalidatorContext {
159 public:
160 PaintInvalidatorContextAdapter(const PaintInvalidationState&);
161 void mapLocalRectToPaintInvalidationBacking(const LayoutObject&, LayoutRect& ) const override;
162 private:
163 const PaintInvalidationState& m_paintInvalidationState;
164 };
165
163 } // namespace blink 166 } // namespace blink
164 167
165 #endif // PaintInvalidationState_h 168 #endif // PaintInvalidationState_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698