| 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 "platform/geometry/LayoutRect.h" | 8 #include "platform/geometry/LayoutRect.h" |
| 9 #include "platform/transforms/AffineTransform.h" | 9 #include "platform/transforms/AffineTransform.h" |
| 10 #include "wtf/Noncopyable.h" | 10 #include "wtf/Noncopyable.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class LayoutBoxModelObject; | 14 class LayoutBoxModelObject; |
| 15 class LayoutObject; | 15 class LayoutObject; |
| 16 class LayoutSVGModelObject; | 16 class LayoutSVGModelObject; |
| 17 class LayoutView; | 17 class LayoutView; |
| 18 | 18 |
| 19 class PaintInvalidationState { | 19 class PaintInvalidationState { |
| 20 WTF_MAKE_NONCOPYABLE(PaintInvalidationState); | 20 WTF_MAKE_NONCOPYABLE(PaintInvalidationState); |
| 21 public: | 21 public: |
| 22 PaintInvalidationState(PaintInvalidationState& next, LayoutBoxModelObject& l
ayoutObject, const LayoutBoxModelObject& paintInvalidationContainer); | 22 PaintInvalidationState(PaintInvalidationState& next, LayoutBoxModelObject& l
ayoutObject, const LayoutBoxModelObject& paintInvalidationContainer); |
| 23 PaintInvalidationState(PaintInvalidationState& next, const LayoutSVGModelObj
ect& layoutObject); | 23 PaintInvalidationState(PaintInvalidationState& next, const LayoutSVGModelObj
ect& layoutObject); |
| 24 | 24 |
| 25 explicit PaintInvalidationState(const LayoutView&, Vector<LayoutObject*>& pe
ndingDelayedPaintInvalidations); | 25 PaintInvalidationState(const LayoutView& layoutView, Vector<LayoutObject*>&
pendingDelayedPaintInvalidations) |
| 26 : PaintInvalidationState(layoutView, pendingDelayedPaintInvalidations, n
ullptr) { } |
| 27 PaintInvalidationState(const LayoutView& layoutView, PaintInvalidationState&
ownerPaintInvalidationState) |
| 28 : PaintInvalidationState(layoutView, ownerPaintInvalidationState.m_pendi
ngDelayedPaintInvalidations, &ownerPaintInvalidationState) { } |
| 26 | 29 |
| 27 const LayoutRect& clipRect() const { return m_clipRect; } | 30 const LayoutRect& clipRect() const { return m_clipRect; } |
| 28 const LayoutSize& paintOffset() const { return m_paintOffset; } | 31 const LayoutSize& paintOffset() const { return m_paintOffset; } |
| 29 const AffineTransform& svgTransform() const { ASSERT(m_svgTransform); return
*m_svgTransform; } | 32 const AffineTransform& svgTransform() const { ASSERT(m_svgTransform); return
*m_svgTransform; } |
| 30 | 33 |
| 31 bool cachedOffsetsEnabled() const { return m_cachedOffsetsEnabled; } | 34 bool cachedOffsetsEnabled() const { return m_cachedOffsetsEnabled; } |
| 32 bool isClipped() const { return m_clipped; } | 35 bool isClipped() const { return m_clipped; } |
| 33 | 36 |
| 34 bool forceCheckForPaintInvalidation() const { return m_forceCheckForPaintInv
alidation; } | 37 bool forceCheckForPaintInvalidation() const { return m_forceCheckForPaintInv
alidation; } |
| 35 void setForceCheckForPaintInvalidation() { m_forceCheckForPaintInvalidation
= true; } | 38 void setForceCheckForPaintInvalidation() { m_forceCheckForPaintInvalidation
= true; } |
| 36 | 39 |
| 37 const LayoutBoxModelObject& paintInvalidationContainer() const { return m_pa
intInvalidationContainer; } | 40 const LayoutBoxModelObject& paintInvalidationContainer() const { return m_pa
intInvalidationContainer; } |
| 38 | 41 |
| 39 bool canMapToContainer(const LayoutBoxModelObject* container) const | 42 bool canMapToContainer(const LayoutBoxModelObject* container) const |
| 40 { | 43 { |
| 41 return m_cachedOffsetsEnabled && container == &m_paintInvalidationContai
ner; | 44 return m_cachedOffsetsEnabled && container == &m_paintInvalidationContai
ner; |
| 42 } | 45 } |
| 43 | 46 |
| 44 // Records |obj| as needing paint invalidation on the next frame. See the de
finition of PaintInvalidationDelayedFull for more details. | 47 // Records |obj| as needing paint invalidation on the next frame. See the de
finition of PaintInvalidationDelayedFull for more details. |
| 45 void pushDelayedPaintInvalidationTarget(LayoutObject& obj) { m_pendingDelaye
dPaintInvalidations.append(&obj); } | 48 void pushDelayedPaintInvalidationTarget(LayoutObject& obj) { m_pendingDelaye
dPaintInvalidations.append(&obj); } |
| 46 Vector<LayoutObject*>& pendingDelayedPaintInvalidationTargets() { return m_p
endingDelayedPaintInvalidations; } | 49 Vector<LayoutObject*>& pendingDelayedPaintInvalidationTargets() { return m_p
endingDelayedPaintInvalidations; } |
| 47 | 50 |
| 48 private: | 51 private: |
| 52 PaintInvalidationState(const LayoutView&, Vector<LayoutObject*>& pendingDela
yedPaintInvalidations, PaintInvalidationState* ownerPaintInvalidationState); |
| 53 |
| 49 void applyClipIfNeeded(const LayoutObject&); | 54 void applyClipIfNeeded(const LayoutObject&); |
| 50 void addClipRectRelativeToPaintOffset(const LayoutSize& clipSize); | 55 void addClipRectRelativeToPaintOffset(const LayoutSize& clipSize); |
| 51 | 56 |
| 52 friend class ForceHorriblySlowRectMapping; | 57 friend class ForceHorriblySlowRectMapping; |
| 53 | 58 |
| 54 bool m_clipped; | 59 bool m_clipped; |
| 55 mutable bool m_cachedOffsetsEnabled; | 60 mutable bool m_cachedOffsetsEnabled; |
| 56 bool m_forceCheckForPaintInvalidation; | 61 bool m_forceCheckForPaintInvalidation; |
| 57 | 62 |
| 58 LayoutRect m_clipRect; | 63 LayoutRect m_clipRect; |
| 59 | 64 |
| 60 // x/y offset from paint invalidation container. Includes relative positioni
ng and scroll offsets. | 65 // x/y offset from paint invalidation container. Includes relative positioni
ng and scroll offsets. |
| 61 LayoutSize m_paintOffset; | 66 LayoutSize m_paintOffset; |
| 62 | 67 |
| 63 const LayoutBoxModelObject& m_paintInvalidationContainer; | 68 const LayoutBoxModelObject& m_paintInvalidationContainer; |
| 64 | 69 |
| 65 // Transform from the initial viewport coordinate system of an outermost | 70 // Transform from the initial viewport coordinate system of an outermost |
| 66 // SVG root to the userspace _before_ the relevant element. Combining this | 71 // SVG root to the userspace _before_ the relevant element. Combining this |
| 67 // with |m_paintOffset| yields the "final" offset. | 72 // with |m_paintOffset| yields the "final" offset. |
| 68 OwnPtr<AffineTransform> m_svgTransform; | 73 OwnPtr<AffineTransform> m_svgTransform; |
| 69 | 74 |
| 70 Vector<LayoutObject*>& m_pendingDelayedPaintInvalidations; | 75 Vector<LayoutObject*>& m_pendingDelayedPaintInvalidations; |
| 71 }; | 76 }; |
| 72 | 77 |
| 73 } // namespace blink | 78 } // namespace blink |
| 74 | 79 |
| 75 #endif // PaintInvalidationState_h | 80 #endif // PaintInvalidationState_h |
| OLD | NEW |