| 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(const PaintInvalidationState& next, LayoutBoxModelObj
ect& renderer, const LayoutBoxModelObject& paintInvalidationContainer); | 22 PaintInvalidationState(PaintInvalidationState& next, LayoutBoxModelObject& r
enderer, const LayoutBoxModelObject& paintInvalidationContainer); |
| 23 PaintInvalidationState(const PaintInvalidationState& next, const LayoutSVGMo
delObject& renderer); | 23 PaintInvalidationState(PaintInvalidationState& next, const LayoutSVGModelObj
ect& renderer); |
| 24 | 24 |
| 25 explicit PaintInvalidationState(const LayoutView&); | 25 explicit PaintInvalidationState(const LayoutView&, Vector<LayoutObject*>& pe
ndingDelayedPaintInvalidations); |
| 26 | 26 |
| 27 const LayoutRect& clipRect() const { return m_clipRect; } | 27 const LayoutRect& clipRect() const { return m_clipRect; } |
| 28 const LayoutSize& paintOffset() const { return m_paintOffset; } | 28 const LayoutSize& paintOffset() const { return m_paintOffset; } |
| 29 const AffineTransform& svgTransform() const { ASSERT(m_svgTransform); return
*m_svgTransform; } | 29 const AffineTransform& svgTransform() const { ASSERT(m_svgTransform); return
*m_svgTransform; } |
| 30 | 30 |
| 31 bool cachedOffsetsEnabled() const { return m_cachedOffsetsEnabled; } | 31 bool cachedOffsetsEnabled() const { return m_cachedOffsetsEnabled; } |
| 32 bool isClipped() const { return m_clipped; } | 32 bool isClipped() const { return m_clipped; } |
| 33 | 33 |
| 34 bool forceCheckForPaintInvalidation() const { return m_forceCheckForPaintInv
alidation; } | 34 bool forceCheckForPaintInvalidation() const { return m_forceCheckForPaintInv
alidation; } |
| 35 void setForceCheckForPaintInvalidation() { m_forceCheckForPaintInvalidation
= true; } | 35 void setForceCheckForPaintInvalidation() { m_forceCheckForPaintInvalidation
= true; } |
| 36 | 36 |
| 37 const LayoutBoxModelObject& paintInvalidationContainer() const { return m_pa
intInvalidationContainer; } | 37 const LayoutBoxModelObject& paintInvalidationContainer() const { return m_pa
intInvalidationContainer; } |
| 38 | 38 |
| 39 bool canMapToContainer(const LayoutBoxModelObject* container) const | 39 bool canMapToContainer(const LayoutBoxModelObject* container) const |
| 40 { | 40 { |
| 41 return m_cachedOffsetsEnabled && container == &m_paintInvalidationContai
ner; | 41 return m_cachedOffsetsEnabled && container == &m_paintInvalidationContai
ner; |
| 42 } | 42 } |
| 43 |
| 44 // 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); } |
| 46 Vector<LayoutObject*>& pendingDelayedPaintInvalidationTargets() { return m_p
endingDelayedPaintInvalidations; } |
| 47 |
| 43 private: | 48 private: |
| 44 void applyClipIfNeeded(const LayoutObject&); | 49 void applyClipIfNeeded(const LayoutObject&); |
| 45 void addClipRectRelativeToPaintOffset(const LayoutSize& clipSize); | 50 void addClipRectRelativeToPaintOffset(const LayoutSize& clipSize); |
| 46 | 51 |
| 47 friend class ForceHorriblySlowRectMapping; | 52 friend class ForceHorriblySlowRectMapping; |
| 48 | 53 |
| 49 bool m_clipped; | 54 bool m_clipped; |
| 50 mutable bool m_cachedOffsetsEnabled; | 55 mutable bool m_cachedOffsetsEnabled; |
| 51 bool m_forceCheckForPaintInvalidation; | 56 bool m_forceCheckForPaintInvalidation; |
| 52 | 57 |
| 53 LayoutRect m_clipRect; | 58 LayoutRect m_clipRect; |
| 54 | 59 |
| 55 // x/y offset from paint invalidation container. Includes relative positioni
ng and scroll offsets. | 60 // x/y offset from paint invalidation container. Includes relative positioni
ng and scroll offsets. |
| 56 LayoutSize m_paintOffset; | 61 LayoutSize m_paintOffset; |
| 57 | 62 |
| 58 const LayoutBoxModelObject& m_paintInvalidationContainer; | 63 const LayoutBoxModelObject& m_paintInvalidationContainer; |
| 59 | 64 |
| 60 // Transform from the initial viewport coordinate system of an outermost | 65 // Transform from the initial viewport coordinate system of an outermost |
| 61 // SVG root to the userspace _before_ the relevant element. Combining this | 66 // SVG root to the userspace _before_ the relevant element. Combining this |
| 62 // with |m_paintOffset| yields the "final" offset. | 67 // with |m_paintOffset| yields the "final" offset. |
| 63 OwnPtr<AffineTransform> m_svgTransform; | 68 OwnPtr<AffineTransform> m_svgTransform; |
| 69 |
| 70 Vector<LayoutObject*>& m_pendingDelayedPaintInvalidations; |
| 64 }; | 71 }; |
| 65 | 72 |
| 66 } // namespace blink | 73 } // namespace blink |
| 67 | 74 |
| 68 #endif // PaintInvalidationState_h | 75 #endif // PaintInvalidationState_h |
| OLD | NEW |