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