OLD | NEW |
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 "platform/geometry/LayoutRect.h" | 9 #include "platform/geometry/LayoutRect.h" |
10 #include "platform/graphics/PaintInvalidationReason.h" | |
11 #include "platform/transforms/AffineTransform.h" | 10 #include "platform/transforms/AffineTransform.h" |
12 #include "wtf/Allocator.h" | 11 #include "wtf/Allocator.h" |
13 #include "wtf/Noncopyable.h" | 12 #include "wtf/Noncopyable.h" |
14 | 13 |
15 namespace blink { | 14 namespace blink { |
16 | 15 |
17 class LayoutBoxModelObject; | 16 class LayoutBoxModelObject; |
18 class LayoutObject; | 17 class LayoutObject; |
19 class LayoutSVGModelObject; | 18 class LayoutSVGModelObject; |
20 class LayoutView; | 19 class LayoutView; |
(...skipping 24 matching lines...) Expand all Loading... |
45 | 44 |
46 // For root LayoutView, or when sub-frame LayoutView's invalidateTreeIfNeede
d() is called directly from | 45 // For root LayoutView, or when sub-frame LayoutView's invalidateTreeIfNeede
d() is called directly from |
47 // FrameView::invalidateTreeIfNeededRecursive() instead of the owner LayoutP
art. | 46 // FrameView::invalidateTreeIfNeededRecursive() instead of the owner LayoutP
art. |
48 // TODO(wangxianzhu): Eliminate the latter case. | 47 // TODO(wangxianzhu): Eliminate the latter case. |
49 PaintInvalidationState(const LayoutView&, Vector<LayoutObject*>& pendingDela
yedPaintInvalidations); | 48 PaintInvalidationState(const LayoutView&, Vector<LayoutObject*>& pendingDela
yedPaintInvalidations); |
50 | 49 |
51 // When a PaintInvalidationState is constructed, it can be used to map point
s/rects in the object's | 50 // 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, | 51 // 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 | 52 // before invalidation of the subtrees, this method must be called to apply
clip and scroll offset |
54 // etc. for creating child PaintInvalidationStates. | 53 // etc. for creating child PaintInvalidationStates. |
55 void updateForChildren(PaintInvalidationReason); | 54 void updateForChildren(); |
56 | 55 |
57 bool hasForcedSubtreeInvalidationFlags() const { return m_forcedSubtreeInval
idationFlags; } | 56 bool forcedSubtreeInvalidationWithinContainer() const { return m_forcedSubtr
eeInvalidationWithinContainer; } |
| 57 void setForceSubtreeInvalidationWithinContainer() { m_forcedSubtreeInvalidat
ionWithinContainer = true; } |
58 | 58 |
59 bool forcedSubtreeInvalidationCheckingWithinContainer() const { return m_for
cedSubtreeInvalidationFlags & InvalidationChecking; } | 59 bool forcedSubtreeInvalidationRectUpdateWithinContainer() const { return m_f
orcedSubtreeInvalidationRectUpdateWithinContainer; } |
60 void setForceSubtreeInvalidationCheckingWithinContainer() { m_forcedSubtreeI
nvalidationFlags |= InvalidationChecking; } | 60 void setForceSubtreeInvalidationRectUpdateWithinContainer() { m_forcedSubtre
eInvalidationRectUpdateWithinContainer = true; } |
61 | |
62 bool forcedSubtreeFullInvalidationWithinContainer() const { return m_forcedS
ubtreeInvalidationFlags & FullInvalidation; } | |
63 | |
64 bool forcedSubtreeInvalidationRectUpdateWithinContainerOnly() const { return
m_forcedSubtreeInvalidationFlags == InvalidationRectUpdate; } | |
65 void setForceSubtreeInvalidationRectUpdateWithinContainer() { m_forcedSubtre
eInvalidationFlags |= InvalidationRectUpdate; } | |
66 | 61 |
67 const LayoutBoxModelObject& paintInvalidationContainer() const { return *m_p
aintInvalidationContainer; } | 62 const LayoutBoxModelObject& paintInvalidationContainer() const { return *m_p
aintInvalidationContainer; } |
68 | 63 |
69 // Computes the position of the current object ((0,0) in the space of the ob
ject) | 64 // Computes the position of the current object ((0,0) in the space of the ob
ject) |
70 // in the space of paint invalidation backing. | 65 // in the space of paint invalidation backing. |
71 LayoutPoint computePositionFromPaintInvalidationBacking() const; | 66 LayoutPoint computePositionFromPaintInvalidationBacking() const; |
72 | 67 |
73 // Returns the rect bounds needed to invalidate paint of this object, | 68 // Returns the rect bounds needed to invalidate paint of this object, |
74 // in the space of paint invalidation backing. | 69 // in the space of paint invalidation backing. |
75 LayoutRect computePaintInvalidationRectInBacking() const; | 70 LayoutRect computePaintInvalidationRectInBacking() const; |
(...skipping 17 matching lines...) Expand all Loading... |
93 | 88 |
94 void updateForCurrentObject(const PaintInvalidationState& parentState); | 89 void updateForCurrentObject(const PaintInvalidationState& parentState); |
95 void updateForNormalChildren(); | 90 void updateForNormalChildren(); |
96 | 91 |
97 LayoutRect computePaintInvalidationRectInBackingForSVG() const; | 92 LayoutRect computePaintInvalidationRectInBackingForSVG() const; |
98 | 93 |
99 void addClipRectRelativeToPaintOffset(const LayoutRect& localClipRect); | 94 void addClipRectRelativeToPaintOffset(const LayoutRect& localClipRect); |
100 | 95 |
101 const LayoutObject& m_currentObject; | 96 const LayoutObject& m_currentObject; |
102 | 97 |
103 enum ForcedSubtreeInvalidationFlag { | 98 bool m_forcedSubtreeInvalidationWithinContainer; |
104 InvalidationChecking = 1 << 0, | 99 bool m_forcedSubtreeInvalidationRectUpdateWithinContainer; |
105 InvalidationRectUpdate = 1 << 1, | |
106 FullInvalidation = 1 << 2, | |
107 FullInvalidationForStackedContents = 1 << 3, | |
108 }; | |
109 unsigned m_forcedSubtreeInvalidationFlags; | |
110 | 100 |
111 bool m_clipped; | 101 bool m_clipped; |
112 bool m_clippedForAbsolutePosition; | 102 bool m_clippedForAbsolutePosition; |
113 | 103 |
114 // Clip rect from paintInvalidationContainer if m_cachedOffsetsEnabled is tr
ue. | 104 // Clip rect from paintInvalidationContainer if m_cachedOffsetsEnabled is tr
ue. |
115 LayoutRect m_clipRect; | 105 LayoutRect m_clipRect; |
116 LayoutRect m_clipRectForAbsolutePosition; | 106 LayoutRect m_clipRectForAbsolutePosition; |
117 | 107 |
118 // x/y offset from the paintInvalidationContainer if m_cachedOffsetsEnabled
is true. | 108 // x/y offset from the paintInvalidationContainer if m_cachedOffsetsEnabled
is true. |
119 // It includes relative positioning and scroll offsets. | 109 // It includes relative positioning and scroll offsets. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 149 |
160 #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY | 150 #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY |
161 void assertFastPathAndSlowPathRectsEqual(const LayoutRect& fastPathRect, con
st LayoutRect& slowPathRect) const; | 151 void assertFastPathAndSlowPathRectsEqual(const LayoutRect& fastPathRect, con
st LayoutRect& slowPathRect) const; |
162 bool m_canCheckFastPathSlowPathEquality; | 152 bool m_canCheckFastPathSlowPathEquality; |
163 #endif | 153 #endif |
164 }; | 154 }; |
165 | 155 |
166 } // namespace blink | 156 } // namespace blink |
167 | 157 |
168 #endif // PaintInvalidationState_h | 158 #endif // PaintInvalidationState_h |
OLD | NEW |