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 * Copyright (C) 2013 Intel Corporation. All rights reserved. | 3 * Copyright (C) 2013 Intel Corporation. All rights reserved. |
4 * | 4 * |
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
6 * | 6 * |
7 * Other contributors: | 7 * Other contributors: |
8 * Robert O'Callahan <roc+@cs.cmu.edu> | 8 * Robert O'Callahan <roc+@cs.cmu.edu> |
9 * David Baron <dbaron@fas.harvard.edu> | 9 * David Baron <dbaron@fas.harvard.edu> |
10 * Christian Biesinger <cbiesinger@web.de> | 10 * Christian Biesinger <cbiesinger@web.de> |
(...skipping 30 matching lines...) Expand all Loading... |
41 * If you do not delete the provisions above, a recipient may use your | 41 * If you do not delete the provisions above, a recipient may use your |
42 * version of this file under any of the LGPL, the MPL or the GPL. | 42 * version of this file under any of the LGPL, the MPL or the GPL. |
43 */ | 43 */ |
44 | 44 |
45 #ifndef DeprecatedPaintLayerClipper_h | 45 #ifndef DeprecatedPaintLayerClipper_h |
46 #define DeprecatedPaintLayerClipper_h | 46 #define DeprecatedPaintLayerClipper_h |
47 | 47 |
48 #include "core/layout/ClipRects.h" | 48 #include "core/layout/ClipRects.h" |
49 #include "core/layout/ClipRectsCache.h" | 49 #include "core/layout/ClipRectsCache.h" |
50 #include "core/layout/LayoutBox.h" | 50 #include "core/layout/LayoutBox.h" |
| 51 #include "wtf/Allocator.h" |
51 | 52 |
52 namespace blink { | 53 namespace blink { |
53 | 54 |
54 class DeprecatedPaintLayer; | 55 class DeprecatedPaintLayer; |
55 | 56 |
56 // This is the state information passed down | 57 // This is the state information passed down |
57 // on the stack for calculating clip rects. | 58 // on the stack for calculating clip rects. |
58 struct ClipRectComputationState { | 59 struct ClipRectComputationState { |
| 60 STACK_ALLOCATED(); |
59 ClipRectComputationState() | 61 ClipRectComputationState() |
60 { | 62 { |
61 currentClipRects.reset(LayoutRect(LayoutRect::infiniteIntRect())); | 63 currentClipRects.reset(LayoutRect(LayoutRect::infiniteIntRect())); |
62 stackingContextClipRects.reset(LayoutRect(LayoutRect::infiniteIntRect())
); | 64 stackingContextClipRects.reset(LayoutRect(LayoutRect::infiniteIntRect())
); |
63 } | 65 } |
64 // Depending on the value of context.isComputingPaintingRect() can have diff
erent meanings | 66 // Depending on the value of context.isComputingPaintingRect() can have diff
erent meanings |
65 // In painting, this ClipRects is used for statically positioned elements, | 67 // In painting, this ClipRects is used for statically positioned elements, |
66 // outside painting, it is the only ClipRects, and is used for all elements. | 68 // outside painting, it is the only ClipRects, and is used for all elements. |
67 ClipRects currentClipRects; | 69 ClipRects currentClipRects; |
68 // During painting this ClipRects is used for positioned elements. It can ha
ve | 70 // During painting this ClipRects is used for positioned elements. It can ha
ve |
69 // a rootLayer further up the tree than currentClipRects because its root mu
st be | 71 // a rootLayer further up the tree than currentClipRects because its root mu
st be |
70 // beyond the enclosing stacking context. See resetPaintRects. | 72 // beyond the enclosing stacking context. See resetPaintRects. |
71 ClipRects stackingContextClipRects; | 73 ClipRects stackingContextClipRects; |
72 }; | 74 }; |
73 | 75 |
74 enum ShouldRespectOverflowClip { | 76 enum ShouldRespectOverflowClip { |
75 IgnoreOverflowClip, | 77 IgnoreOverflowClip, |
76 RespectOverflowClip | 78 RespectOverflowClip |
77 }; | 79 }; |
78 | 80 |
79 class ClipRectsContext { | 81 class ClipRectsContext { |
| 82 STACK_ALLOCATED(); |
80 public: | 83 public: |
81 ClipRectsContext(const DeprecatedPaintLayer* root, ClipRectsCacheSlot slot,
OverlayScrollbarSizeRelevancy relevancy = IgnoreOverlayScrollbarSize, const Layo
utSize& accumulation = LayoutSize()) | 84 ClipRectsContext(const DeprecatedPaintLayer* root, ClipRectsCacheSlot slot,
OverlayScrollbarSizeRelevancy relevancy = IgnoreOverlayScrollbarSize, const Layo
utSize& accumulation = LayoutSize()) |
82 : rootLayer(root) | 85 : rootLayer(root) |
83 , scrollbarRelevancy(relevancy) | 86 , scrollbarRelevancy(relevancy) |
84 , m_cacheSlot(slot) | 87 , m_cacheSlot(slot) |
85 , subPixelAccumulation(accumulation) | 88 , subPixelAccumulation(accumulation) |
86 , respectOverflowClip(slot == PaintingClipRectsIgnoringOverflowClip ? Ig
noreOverflowClip : RespectOverflowClip) | 89 , respectOverflowClip(slot == PaintingClipRectsIgnoringOverflowClip ? Ig
noreOverflowClip : RespectOverflowClip) |
87 , respectOverflowClipForViewport(slot == RootRelativeClipRectsIgnoringVi
ewportClip ? IgnoreOverflowClip : RespectOverflowClip) | 90 , respectOverflowClipForViewport(slot == RootRelativeClipRectsIgnoringVi
ewportClip ? IgnoreOverflowClip : RespectOverflowClip) |
88 { | 91 { |
89 } | 92 } |
(...skipping 28 matching lines...) Expand all Loading... |
118 private: | 121 private: |
119 friend class DeprecatedPaintLayerClipper; | 122 friend class DeprecatedPaintLayerClipper; |
120 | 123 |
121 ClipRectsCacheSlot m_cacheSlot; | 124 ClipRectsCacheSlot m_cacheSlot; |
122 LayoutSize subPixelAccumulation; | 125 LayoutSize subPixelAccumulation; |
123 ShouldRespectOverflowClip respectOverflowClip; | 126 ShouldRespectOverflowClip respectOverflowClip; |
124 ShouldRespectOverflowClip respectOverflowClipForViewport; | 127 ShouldRespectOverflowClip respectOverflowClipForViewport; |
125 }; | 128 }; |
126 | 129 |
127 class DeprecatedPaintLayerClipper { | 130 class DeprecatedPaintLayerClipper { |
| 131 DISALLOW_ALLOCATION(); |
128 WTF_MAKE_NONCOPYABLE(DeprecatedPaintLayerClipper); | 132 WTF_MAKE_NONCOPYABLE(DeprecatedPaintLayerClipper); |
129 public: | 133 public: |
130 explicit DeprecatedPaintLayerClipper(LayoutBoxModelObject&); | 134 explicit DeprecatedPaintLayerClipper(LayoutBoxModelObject&); |
131 | 135 |
132 void clearClipRectsIncludingDescendants(); | 136 void clearClipRectsIncludingDescendants(); |
133 void clearClipRectsIncludingDescendants(ClipRectsCacheSlot); | 137 void clearClipRectsIncludingDescendants(ClipRectsCacheSlot); |
134 | 138 |
135 LayoutRect childrenClipRect() const; // Returns the foreground clip rect of
the layer in the document's coordinate space. | 139 LayoutRect childrenClipRect() const; // Returns the foreground clip rect of
the layer in the document's coordinate space. |
136 LayoutRect localClipRect() const; // Returns the background clip rect of the
layer in the local coordinate space. | 140 LayoutRect localClipRect() const; // Returns the background clip rect of the
layer in the local coordinate space. |
137 | 141 |
(...skipping 24 matching lines...) Expand all Loading... |
162 bool shouldRespectOverflowClip(const ClipRectsContext&) const; | 166 bool shouldRespectOverflowClip(const ClipRectsContext&) const; |
163 | 167 |
164 // FIXME: Could this be a LayoutBox? | 168 // FIXME: Could this be a LayoutBox? |
165 LayoutBoxModelObject& m_layoutObject; | 169 LayoutBoxModelObject& m_layoutObject; |
166 mutable OwnPtr<ClipRect> m_clips[NumberOfClipRectsCacheSlots]; | 170 mutable OwnPtr<ClipRect> m_clips[NumberOfClipRectsCacheSlots]; |
167 }; | 171 }; |
168 | 172 |
169 } // namespace blink | 173 } // namespace blink |
170 | 174 |
171 #endif // LayerClipper_h | 175 #endif // LayerClipper_h |
OLD | NEW |