OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 13 matching lines...) Expand all Loading... |
24 */ | 24 */ |
25 | 25 |
26 #ifndef ClipRects_h | 26 #ifndef ClipRects_h |
27 #define ClipRects_h | 27 #define ClipRects_h |
28 | 28 |
29 #include "core/layout/ClipRect.h" | 29 #include "core/layout/ClipRect.h" |
30 #include "wtf/RefCounted.h" | 30 #include "wtf/RefCounted.h" |
31 | 31 |
32 namespace blink { | 32 namespace blink { |
33 | 33 |
34 class DeprecatedPaintLayer; | 34 class ClipRects : public RefCounted<ClipRects> { |
35 | |
36 class ClipRects { | |
37 WTF_MAKE_FAST_ALLOCATED(ClipRects); | 35 WTF_MAKE_FAST_ALLOCATED(ClipRects); |
38 public: | 36 public: |
| 37 static PassRefPtr<ClipRects> create() |
| 38 { |
| 39 return adoptRef(new ClipRects); |
| 40 } |
| 41 static PassRefPtr<ClipRects> create(const ClipRects& other) |
| 42 { |
| 43 return adoptRef(new ClipRects(other)); |
| 44 } |
39 | 45 |
40 ClipRects() | 46 ClipRects() |
41 : m_rootLayer(nullptr) | 47 : m_fixed(0) |
42 , m_fixed(0) | |
43 { | 48 { |
44 } | 49 } |
45 | 50 |
46 void reset(const LayoutRect& r) | 51 void reset(const LayoutRect& r) |
47 { | 52 { |
48 m_overflowClipRect = r; | 53 m_overflowClipRect = r; |
49 m_fixedClipRect = r; | 54 m_fixedClipRect = r; |
50 m_posClipRect = r; | 55 m_posClipRect = r; |
51 m_fixed = 0; | 56 m_fixed = 0; |
52 } | 57 } |
(...skipping 17 matching lines...) Expand all Loading... |
70 && m_posClipRect == other.posClipRect() | 75 && m_posClipRect == other.posClipRect() |
71 && fixed() == other.fixed(); | 76 && fixed() == other.fixed(); |
72 } | 77 } |
73 | 78 |
74 ClipRects& operator=(const ClipRects& other) | 79 ClipRects& operator=(const ClipRects& other) |
75 { | 80 { |
76 m_overflowClipRect = other.overflowClipRect(); | 81 m_overflowClipRect = other.overflowClipRect(); |
77 m_fixedClipRect = other.fixedClipRect(); | 82 m_fixedClipRect = other.fixedClipRect(); |
78 m_posClipRect = other.posClipRect(); | 83 m_posClipRect = other.posClipRect(); |
79 m_fixed = other.fixed(); | 84 m_fixed = other.fixed(); |
80 m_rootLayer = other.m_rootLayer; | |
81 return *this; | 85 return *this; |
82 } | 86 } |
83 | 87 |
84 void setRootLayer(const DeprecatedPaintLayer* layer) | |
85 { | |
86 m_rootLayer = layer; | |
87 } | |
88 | |
89 const DeprecatedPaintLayer* rootLayer() | |
90 { | |
91 return m_rootLayer; | |
92 } | |
93 | |
94 private: | 88 private: |
95 ClipRects(const LayoutRect& r) | 89 ClipRects(const LayoutRect& r) |
96 : m_rootLayer(nullptr) | 90 : m_overflowClipRect(r) |
97 , m_overflowClipRect(r) | |
98 , m_fixedClipRect(r) | 91 , m_fixedClipRect(r) |
99 , m_posClipRect(r) | 92 , m_posClipRect(r) |
100 , m_fixed(0) | 93 , m_fixed(0) |
101 { | 94 { |
102 } | 95 } |
103 | 96 |
104 ClipRects(const ClipRects& other) | 97 ClipRects(const ClipRects& other) |
105 : m_rootLayer(other.m_rootLayer) | 98 : m_overflowClipRect(other.overflowClipRect()) |
106 , m_overflowClipRect(other.overflowClipRect()) | |
107 , m_fixedClipRect(other.fixedClipRect()) | 99 , m_fixedClipRect(other.fixedClipRect()) |
108 , m_posClipRect(other.posClipRect()) | 100 , m_posClipRect(other.posClipRect()) |
109 , m_fixed(other.fixed()) | 101 , m_fixed(other.fixed()) |
110 { | 102 { |
111 } | 103 } |
112 | 104 |
113 // ClipRects are accumulated relative to this layer. Its clips and the clips | |
114 // of its descendents are intersected down to the layer being calculated. It | |
115 // also determines the coordinate space of the clips. | |
116 const DeprecatedPaintLayer* m_rootLayer; | |
117 ClipRect m_overflowClipRect; | 105 ClipRect m_overflowClipRect; |
118 ClipRect m_fixedClipRect; | 106 ClipRect m_fixedClipRect; |
119 ClipRect m_posClipRect; | 107 ClipRect m_posClipRect; |
120 unsigned m_fixed; | 108 unsigned m_fixed; |
121 }; | 109 }; |
122 | 110 |
123 } // namespace blink | 111 } // namespace blink |
124 | 112 |
125 #endif // ClipRects_h | 113 #endif // ClipRects_h |
OLD | NEW |