| 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 "wtf/Noncopyable.h" | 10 #include "wtf/Noncopyable.h" |
| 10 | 11 |
| 11 namespace blink { | 12 namespace blink { |
| 12 | 13 |
| 13 class RenderLayerModelObject; | 14 class RenderLayerModelObject; |
| 14 class RenderObject; | 15 class RenderObject; |
| 16 class RenderSVGModelObject; |
| 15 class RenderView; | 17 class RenderView; |
| 16 | 18 |
| 17 class PaintInvalidationState { | 19 class PaintInvalidationState { |
| 18 WTF_MAKE_NONCOPYABLE(PaintInvalidationState); | 20 WTF_MAKE_NONCOPYABLE(PaintInvalidationState); |
| 19 public: | 21 public: |
| 20 PaintInvalidationState(const PaintInvalidationState& next, RenderLayerModelO
bject& renderer, const RenderLayerModelObject& paintInvalidationContainer); | 22 PaintInvalidationState(const PaintInvalidationState& next, RenderLayerModelO
bject& renderer, const RenderLayerModelObject& paintInvalidationContainer); |
| 23 PaintInvalidationState(const PaintInvalidationState& next, const RenderSVGMo
delObject& renderer); |
| 21 | 24 |
| 22 explicit PaintInvalidationState(const RenderView&); | 25 explicit PaintInvalidationState(const RenderView&); |
| 23 | 26 |
| 24 const LayoutRect& clipRect() const { return m_clipRect; } | 27 const LayoutRect& clipRect() const { return m_clipRect; } |
| 25 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; } |
| 26 | 30 |
| 27 bool cachedOffsetsEnabled() const { return m_cachedOffsetsEnabled; } | 31 bool cachedOffsetsEnabled() const { return m_cachedOffsetsEnabled; } |
| 28 bool isClipped() const { return m_clipped; } | 32 bool isClipped() const { return m_clipped; } |
| 29 | 33 |
| 30 bool forceCheckForPaintInvalidation() const { return m_forceCheckForPaintInv
alidation; } | 34 bool forceCheckForPaintInvalidation() const { return m_forceCheckForPaintInv
alidation; } |
| 31 void setForceCheckForPaintInvalidation() { m_forceCheckForPaintInvalidation
= true; } | 35 void setForceCheckForPaintInvalidation() { m_forceCheckForPaintInvalidation
= true; } |
| 32 | 36 |
| 33 const RenderLayerModelObject& paintInvalidationContainer() const { return m_
paintInvalidationContainer; } | 37 const RenderLayerModelObject& paintInvalidationContainer() const { return m_
paintInvalidationContainer; } |
| 34 | 38 |
| 35 bool canMapToContainer(const RenderLayerModelObject* container) const | 39 bool canMapToContainer(const RenderLayerModelObject* container) const |
| 36 { | 40 { |
| 37 return m_cachedOffsetsEnabled && container == &m_paintInvalidationContai
ner; | 41 return m_cachedOffsetsEnabled && container == &m_paintInvalidationContai
ner; |
| 38 } | 42 } |
| 39 private: | 43 private: |
| 40 void applyClipIfNeeded(const RenderObject&); | 44 void applyClipIfNeeded(const RenderObject&); |
| 45 void addClipRectRelativeToPaintOffset(const LayoutSize& clipSize); |
| 41 | 46 |
| 42 friend class ForceHorriblySlowRectMapping; | 47 friend class ForceHorriblySlowRectMapping; |
| 43 | 48 |
| 44 bool m_clipped; | 49 bool m_clipped; |
| 45 mutable bool m_cachedOffsetsEnabled; | 50 mutable bool m_cachedOffsetsEnabled; |
| 46 bool m_forceCheckForPaintInvalidation; | 51 bool m_forceCheckForPaintInvalidation; |
| 47 | 52 |
| 48 LayoutRect m_clipRect; | 53 LayoutRect m_clipRect; |
| 49 | 54 |
| 50 // x/y offset from paint invalidation container. Includes relative positioni
ng and scroll offsets. | 55 // x/y offset from paint invalidation container. Includes relative positioni
ng and scroll offsets. |
| 51 LayoutSize m_paintOffset; | 56 LayoutSize m_paintOffset; |
| 52 | 57 |
| 53 const RenderLayerModelObject& m_paintInvalidationContainer; | 58 const RenderLayerModelObject& m_paintInvalidationContainer; |
| 59 |
| 60 // Transform from the initial viewport coordinate system of an outermost |
| 61 // SVG root to the userspace _before_ the relevant element. Combining this |
| 62 // with |m_paintOffset| yields the "final" offset. |
| 63 OwnPtr<AffineTransform> m_svgTransform; |
| 54 }; | 64 }; |
| 55 | 65 |
| 56 } // namespace blink | 66 } // namespace blink |
| 57 | 67 |
| 58 #endif // PaintInvalidationState_h | 68 #endif // PaintInvalidationState_h |
| OLD | NEW |