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 24 matching lines...) Expand all Loading... |
35 * applicable instead of those above. If you wish to allow use of your | 35 * applicable instead of those above. If you wish to allow use of your |
36 * version of this file only under the terms of one of those two | 36 * version of this file only under the terms of one of those two |
37 * licenses (the MPL or the GPL) and not to allow others to use your | 37 * licenses (the MPL or the GPL) and not to allow others to use your |
38 * version of this file under the LGPL, indicate your decision by | 38 * version of this file under the LGPL, indicate your decision by |
39 * deletingthe provisions above and replace them with the notice and | 39 * deletingthe provisions above and replace them with the notice and |
40 * other provisions required by the MPL or the GPL, as the case may be. | 40 * other provisions required by the MPL or the GPL, as the case may be. |
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 RenderLayerClipper_h | 45 #ifndef LayerClipper_h |
46 #define RenderLayerClipper_h | 46 #define LayerClipper_h |
47 | 47 |
48 #include "core/rendering/ClipRectsCache.h" | 48 #include "core/rendering/ClipRectsCache.h" |
49 #include "core/rendering/RenderBox.h" | 49 #include "core/rendering/RenderBox.h" |
50 | 50 |
51 namespace blink { | 51 namespace blink { |
52 | 52 |
53 class RenderLayer; | 53 class Layer; |
54 | 54 |
55 enum ShouldRespectOverflowClip { | 55 enum ShouldRespectOverflowClip { |
56 IgnoreOverflowClip, | 56 IgnoreOverflowClip, |
57 RespectOverflowClip | 57 RespectOverflowClip |
58 }; | 58 }; |
59 | 59 |
60 class ClipRectsContext { | 60 class ClipRectsContext { |
61 public: | 61 public: |
62 ClipRectsContext(const RenderLayer* root, ClipRectsCacheSlot slot, OverlaySc
rollbarSizeRelevancy relevancy = IgnoreOverlayScrollbarSize, const LayoutSize& a
ccumulation = LayoutSize()) | 62 ClipRectsContext(const Layer* root, ClipRectsCacheSlot slot, OverlayScrollba
rSizeRelevancy relevancy = IgnoreOverlayScrollbarSize, const LayoutSize& accumul
ation = LayoutSize()) |
63 : rootLayer(root) | 63 : rootLayer(root) |
64 , scrollbarRelevancy(relevancy) | 64 , scrollbarRelevancy(relevancy) |
65 , cacheSlot(slot) | 65 , cacheSlot(slot) |
66 , subPixelAccumulation(accumulation) | 66 , subPixelAccumulation(accumulation) |
67 , respectOverflowClip(slot == PaintingClipRectsIgnoringOverflowClip ? Ig
noreOverflowClip : RespectOverflowClip) | 67 , respectOverflowClip(slot == PaintingClipRectsIgnoringOverflowClip ? Ig
noreOverflowClip : RespectOverflowClip) |
68 { | 68 { |
69 } | 69 } |
70 | 70 |
71 void setIgnoreOverflowClip() | 71 void setIgnoreOverflowClip() |
72 { | 72 { |
73 ASSERT(!usesCache() || cacheSlot == PaintingClipRects); | 73 ASSERT(!usesCache() || cacheSlot == PaintingClipRects); |
74 ASSERT(respectOverflowClip == RespectOverflowClip); | 74 ASSERT(respectOverflowClip == RespectOverflowClip); |
75 if (usesCache()) | 75 if (usesCache()) |
76 cacheSlot = PaintingClipRectsIgnoringOverflowClip; | 76 cacheSlot = PaintingClipRectsIgnoringOverflowClip; |
77 respectOverflowClip = IgnoreOverflowClip; | 77 respectOverflowClip = IgnoreOverflowClip; |
78 } | 78 } |
79 | 79 |
80 bool usesCache() const | 80 bool usesCache() const |
81 { | 81 { |
82 return cacheSlot != UncachedClipRects; | 82 return cacheSlot != UncachedClipRects; |
83 } | 83 } |
84 | 84 |
85 const RenderLayer* const rootLayer; | 85 const Layer* const rootLayer; |
86 const OverlayScrollbarSizeRelevancy scrollbarRelevancy; | 86 const OverlayScrollbarSizeRelevancy scrollbarRelevancy; |
87 | 87 |
88 private: | 88 private: |
89 friend class RenderLayerClipper; | 89 friend class LayerClipper; |
90 | 90 |
91 ClipRectsCacheSlot cacheSlot; | 91 ClipRectsCacheSlot cacheSlot; |
92 LayoutSize subPixelAccumulation; | 92 LayoutSize subPixelAccumulation; |
93 ShouldRespectOverflowClip respectOverflowClip; | 93 ShouldRespectOverflowClip respectOverflowClip; |
94 }; | 94 }; |
95 | 95 |
96 class RenderLayerClipper { | 96 class LayerClipper { |
97 WTF_MAKE_NONCOPYABLE(RenderLayerClipper); | 97 WTF_MAKE_NONCOPYABLE(LayerClipper); |
98 public: | 98 public: |
99 explicit RenderLayerClipper(RenderLayerModelObject&); | 99 explicit LayerClipper(LayoutLayerModelObject&); |
100 | 100 |
101 void clearClipRectsIncludingDescendants(); | 101 void clearClipRectsIncludingDescendants(); |
102 void clearClipRectsIncludingDescendants(ClipRectsCacheSlot); | 102 void clearClipRectsIncludingDescendants(ClipRectsCacheSlot); |
103 | 103 |
104 LayoutRect childrenClipRect() const; // Returns the foreground clip rect of
the layer in the document's coordinate space. | 104 LayoutRect childrenClipRect() const; // Returns the foreground clip rect of
the layer in the document's coordinate space. |
105 LayoutRect localClipRect() const; // Returns the background clip rect of the
layer in the local coordinate space. | 105 LayoutRect localClipRect() const; // Returns the background clip rect of the
layer in the local coordinate space. |
106 | 106 |
107 ClipRects* getClipRects(const ClipRectsContext&) const; | 107 ClipRects* getClipRects(const ClipRectsContext&) const; |
108 | 108 |
109 ClipRect backgroundClipRect(const ClipRectsContext&) const; | 109 ClipRect backgroundClipRect(const ClipRectsContext&) const; |
(...skipping 13 matching lines...) Expand all Loading... |
123 | 123 |
124 // cachedClipRects looks buggy: It doesn't check whether context.rootLayer a
nd entry.root match. | 124 // cachedClipRects looks buggy: It doesn't check whether context.rootLayer a
nd entry.root match. |
125 // FIXME: Move callers to clipRectsIfCached, which does the proper checks. | 125 // FIXME: Move callers to clipRectsIfCached, which does the proper checks. |
126 ClipRects* cachedClipRects(const ClipRectsContext& context) const | 126 ClipRects* cachedClipRects(const ClipRectsContext& context) const |
127 { | 127 { |
128 return m_cache ? m_cache->get(context.cacheSlot).clipRects.get() : 0; | 128 return m_cache ? m_cache->get(context.cacheSlot).clipRects.get() : 0; |
129 } | 129 } |
130 | 130 |
131 void getOrCalculateClipRects(const ClipRectsContext&, ClipRects&) const; | 131 void getOrCalculateClipRects(const ClipRectsContext&, ClipRects&) const; |
132 | 132 |
133 RenderLayer* clippingRootForPainting() const; | 133 Layer* clippingRootForPainting() const; |
134 | 134 |
135 ClipRectsCache& cache() const | 135 ClipRectsCache& cache() const |
136 { | 136 { |
137 if (!m_cache) | 137 if (!m_cache) |
138 m_cache = adoptPtr(new ClipRectsCache); | 138 m_cache = adoptPtr(new ClipRectsCache); |
139 return *m_cache; | 139 return *m_cache; |
140 } | 140 } |
141 | 141 |
142 // FIXME: Could this be a RenderBox? | 142 // FIXME: Could this be a RenderBox? |
143 RenderLayerModelObject& m_renderer; | 143 LayoutLayerModelObject& m_renderer; |
144 mutable OwnPtr<ClipRectsCache> m_cache; | 144 mutable OwnPtr<ClipRectsCache> m_cache; |
145 }; | 145 }; |
146 | 146 |
147 } // namespace blink | 147 } // namespace blink |
148 | 148 |
149 #endif // RenderLayerClipper_h | 149 #endif // LayerClipper_h |
OLD | NEW |