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 3 // found in the LICENSE file. 4 5 #ifndef PaintInvalidationState_h 6 #define PaintInvalidationState_h 7 8 #include "platform/geometry/LayoutRect.h" 9 #include "wtf/Noncopyable.h" 10 11 namespace blink { 12 13 class RenderLayerModelObject; 14 class RenderObject; 15 class RenderView; 16 17 class PaintInvalidationState { 18 WTF_MAKE_NONCOPYABLE(PaintInvalidationState); 19 public: 20 PaintInvalidationState(const PaintInvalidationState& next, RenderLayerModelObject& renderer, const RenderLayerModelObject& paintInvalidationContainer); 21 22 explicit PaintInvalidationState(const RenderView&); 23 24 const LayoutRect& clipRect() const { return m_clipRect; } 25 const LayoutSize& paintOffset() const { return m_paintOffset; } 26 27 bool cachedOffsetsEnabled() const { return m_cachedOffsetsEnabled; } 28 bool isClipped() const { return m_clipped; } 29 30 bool forceCheckForPaintInvalidation() const { return m_forceCheckForPaintInvalidation; } 31 void setForceCheckForPaintInvalidation() { m_forceCheckForPaintInvalidation = true; } 32 33 const RenderLayerModelObject& paintInvalidationContainer() const { return m_paintInvalidationContainer; } 34 35 bool canMapToContainer(const RenderLayerModelObject* container) const 36 { 37 return m_cachedOffsetsEnabled && container == &m_paintInvalidationContainer; 38 } 39 private: 40 void applyClipIfNeeded(const RenderObject&); 41 42 friend class ForceHorriblySlowRectMapping; 43 44 bool m_clipped; 45 mutable bool m_cachedOffsetsEnabled; 46 bool m_forceCheckForPaintInvalidation; 47 48 LayoutRect m_clipRect; 49 50 // x/y offset from paint invalidation container. Includes relative positioning and scroll offsets. 51 LayoutSize m_paintOffset; 52 53 const RenderLayerModelObject& m_paintInvalidationContainer; 54 }; 55 56 } // namespace blink 57 58 #endif // PaintInvalidationState_h 59