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 "wtf/Noncopyable.h" | 9 #include "wtf/Noncopyable.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class RenderBox; | 13 class RenderBox; |
14 class RenderInline; | 14 class RenderInline; |
15 class RenderLayerModelObject; | 15 class RenderLayerModelObject; |
16 class RenderObject; | 16 class RenderObject; |
| 17 class RenderView; |
17 class RenderSVGModelObject; | 18 class RenderSVGModelObject; |
18 | 19 |
19 class PaintInvalidationState { | 20 class PaintInvalidationState { |
20 WTF_MAKE_NONCOPYABLE(PaintInvalidationState); | 21 WTF_MAKE_NONCOPYABLE(PaintInvalidationState); |
21 public: | 22 public: |
22 PaintInvalidationState(const PaintInvalidationState& next, RenderLayerModelO
bject& renderer, const RenderLayerModelObject& paintInvalidationContainer); | 23 PaintInvalidationState(const PaintInvalidationState& next, RenderLayerModelO
bject& renderer, const RenderLayerModelObject& paintInvalidationContainer); |
23 | 24 |
24 explicit PaintInvalidationState(RenderObject&); | 25 explicit PaintInvalidationState(const RenderView&); |
25 | 26 |
26 const LayoutRect& clipRect() const { return m_clipRect; } | 27 const LayoutRect& clipRect() const { return m_clipRect; } |
27 const LayoutSize& paintOffset() const { return m_paintOffset; } | 28 const LayoutSize& paintOffset() const { return m_paintOffset; } |
28 | 29 |
29 bool cachedOffsetsEnabled() const { return m_cachedOffsetsEnabled; } | 30 bool cachedOffsetsEnabled() const { return m_cachedOffsetsEnabled; } |
30 bool isClipped() const { return m_clipped; } | 31 bool isClipped() const { return m_clipped; } |
31 | 32 |
32 bool forceCheckForPaintInvalidation() const { return m_forceCheckForPaintInv
alidation; } | 33 bool forceCheckForPaintInvalidation() const { return m_forceCheckForPaintInv
alidation; } |
33 void setForceCheckForPaintInvalidation() { m_forceCheckForPaintInvalidation
= true; } | 34 void setForceCheckForPaintInvalidation() { m_forceCheckForPaintInvalidation
= true; } |
34 | 35 |
35 const RenderLayerModelObject& paintInvalidationContainer() const { return m_
paintInvalidationContainer; } | 36 const RenderLayerModelObject& paintInvalidationContainer() const { return m_
paintInvalidationContainer; } |
36 RenderObject& renderer() const { return m_renderer; } | 37 const RenderObject& renderer() const { return m_renderer; } |
37 | 38 |
38 bool canMapToContainer(const RenderLayerModelObject* container) const | 39 bool canMapToContainer(const RenderLayerModelObject* container) const |
39 { | 40 { |
40 return m_cachedOffsetsEnabled && container == &m_paintInvalidationContai
ner; | 41 return m_cachedOffsetsEnabled && container == &m_paintInvalidationContai
ner; |
41 } | 42 } |
42 private: | 43 private: |
43 void applyClipIfNeeded(const RenderObject&); | 44 void applyClipIfNeeded(const RenderObject&); |
44 | 45 |
45 friend class ForceHorriblySlowRectMapping; | 46 friend class ForceHorriblySlowRectMapping; |
46 | 47 |
47 bool m_clipped; | 48 bool m_clipped; |
48 mutable bool m_cachedOffsetsEnabled; | 49 mutable bool m_cachedOffsetsEnabled; |
49 bool m_forceCheckForPaintInvalidation; | 50 bool m_forceCheckForPaintInvalidation; |
50 | 51 |
51 LayoutRect m_clipRect; | 52 LayoutRect m_clipRect; |
52 | 53 |
53 // x/y offset from paint invalidation container. Includes relative positioni
ng and scroll offsets. | 54 // x/y offset from paint invalidation container. Includes relative positioni
ng and scroll offsets. |
54 LayoutSize m_paintOffset; | 55 LayoutSize m_paintOffset; |
55 | 56 |
56 const RenderLayerModelObject& m_paintInvalidationContainer; | 57 const RenderLayerModelObject& m_paintInvalidationContainer; |
57 | 58 |
58 RenderObject& m_renderer; | 59 const RenderObject& m_renderer; |
59 }; | 60 }; |
60 | 61 |
61 } // namespace blink | 62 } // namespace blink |
62 | 63 |
63 #endif // PaintInvalidationState_h | 64 #endif // PaintInvalidationState_h |
OLD | NEW |