OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
3 * | 3 * |
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
(...skipping 24 matching lines...) Expand all Loading... |
35 * version of this file only under the terms of one of those two | 35 * version of this file only under the terms of one of those two |
36 * licenses (the MPL or the GPL) and not to allow others to use your | 36 * licenses (the MPL or the GPL) and not to allow others to use your |
37 * version of this file under the LGPL, indicate your decision by | 37 * version of this file under the LGPL, indicate your decision by |
38 * deletingthe provisions above and replace them with the notice and | 38 * deletingthe provisions above and replace them with the notice and |
39 * other provisions required by the MPL or the GPL, as the case may be. | 39 * other provisions required by the MPL or the GPL, as the case may be. |
40 * If you do not delete the provisions above, a recipient may use your | 40 * If you do not delete the provisions above, a recipient may use your |
41 * version of this file under any of the LGPL, the MPL or the GPL. | 41 * version of this file under any of the LGPL, the MPL or the GPL. |
42 */ | 42 */ |
43 | 43 |
44 #include "config.h" | 44 #include "config.h" |
45 #include "core/rendering/RenderLayerClipper.h" | 45 #include "core/layout/LayerClipper.h" |
46 | 46 |
47 #include "core/frame/Settings.h" | 47 #include "core/frame/Settings.h" |
48 #include "core/rendering/RenderLayer.h" | 48 #include "core/layout/Layer.h" |
49 #include "core/rendering/RenderView.h" | 49 #include "core/rendering/RenderView.h" |
50 | 50 |
51 namespace blink { | 51 namespace blink { |
52 | 52 |
53 static void adjustClipRectsForChildren(const RenderObject& renderer, ClipRects&
clipRects) | 53 static void adjustClipRectsForChildren(const RenderObject& renderer, ClipRects&
clipRects) |
54 { | 54 { |
55 EPosition position = renderer.style()->position(); | 55 EPosition position = renderer.style()->position(); |
56 // A fixed object is essentially the root of its containing block hierarchy,
so when | 56 // A fixed object is essentially the root of its containing block hierarchy,
so when |
57 // we encounter such an object, we reset our clip rects to the fixedClipRect
. | 57 // we encounter such an object, we reset our clip rects to the fixedClipRect
. |
58 if (position == FixedPosition) { | 58 if (position == FixedPosition) { |
(...skipping 25 matching lines...) Expand all Loading... |
84 } | 84 } |
85 | 85 |
86 if (renderer.hasClip()) { | 86 if (renderer.hasClip()) { |
87 LayoutRect newClip = toRenderBox(renderer).clipRect(offset); | 87 LayoutRect newClip = toRenderBox(renderer).clipRect(offset); |
88 clipRects.setPosClipRect(intersection(newClip, clipRects.posClipRect()))
; | 88 clipRects.setPosClipRect(intersection(newClip, clipRects.posClipRect()))
; |
89 clipRects.setOverflowClipRect(intersection(newClip, clipRects.overflowCl
ipRect())); | 89 clipRects.setOverflowClipRect(intersection(newClip, clipRects.overflowCl
ipRect())); |
90 clipRects.setFixedClipRect(intersection(newClip, clipRects.fixedClipRect
())); | 90 clipRects.setFixedClipRect(intersection(newClip, clipRects.fixedClipRect
())); |
91 } | 91 } |
92 } | 92 } |
93 | 93 |
94 RenderLayerClipper::RenderLayerClipper(RenderLayerModelObject& renderer) | 94 LayerClipper::LayerClipper(LayoutLayerModelObject& renderer) |
95 : m_renderer(renderer) | 95 : m_renderer(renderer) |
96 { | 96 { |
97 } | 97 } |
98 | 98 |
99 ClipRects* RenderLayerClipper::clipRectsIfCached(const ClipRectsContext& context
) const | 99 ClipRects* LayerClipper::clipRectsIfCached(const ClipRectsContext& context) cons
t |
100 { | 100 { |
101 ASSERT(context.usesCache()); | 101 ASSERT(context.usesCache()); |
102 if (!m_cache) | 102 if (!m_cache) |
103 return 0; | 103 return 0; |
104 ClipRectsCache::Entry& entry = m_cache->get(context.cacheSlot); | 104 ClipRectsCache::Entry& entry = m_cache->get(context.cacheSlot); |
105 // FIXME: We used to ASSERT that we always got a consistent root layer. | 105 // FIXME: We used to ASSERT that we always got a consistent root layer. |
106 // We should add a test that has an inconsistent root. See | 106 // We should add a test that has an inconsistent root. See |
107 // http://crbug.com/366118 for an example. | 107 // http://crbug.com/366118 for an example. |
108 if (context.rootLayer != entry.root) | 108 if (context.rootLayer != entry.root) |
109 return 0; | 109 return 0; |
110 ASSERT(entry.scrollbarRelevancy == context.scrollbarRelevancy); | 110 ASSERT(entry.scrollbarRelevancy == context.scrollbarRelevancy); |
111 | 111 |
112 #ifdef CHECK_CACHED_CLIP_RECTS | 112 #ifdef CHECK_CACHED_CLIP_RECTS |
113 // This code is useful to check cached clip rects, but is too expensive to l
eave enabled in debug builds by default. | 113 // This code is useful to check cached clip rects, but is too expensive to l
eave enabled in debug builds by default. |
114 ClipRectsContext tempContext(context); | 114 ClipRectsContext tempContext(context); |
115 tempContext.cacheSlot = UncachedClipRects; | 115 tempContext.cacheSlot = UncachedClipRects; |
116 RefPtr<ClipRects> clipRects = ClipRects::create(); | 116 RefPtr<ClipRects> clipRects = ClipRects::create(); |
117 calculateClipRects(tempContext, *clipRects); | 117 calculateClipRects(tempContext, *clipRects); |
118 ASSERT(clipRects == *entry.clipRects); | 118 ASSERT(clipRects == *entry.clipRects); |
119 #endif | 119 #endif |
120 | 120 |
121 return entry.clipRects.get(); | 121 return entry.clipRects.get(); |
122 } | 122 } |
123 | 123 |
124 ClipRects* RenderLayerClipper::storeClipRectsInCache(const ClipRectsContext& con
text, ClipRects* parentClipRects, const ClipRects& clipRects) const | 124 ClipRects* LayerClipper::storeClipRectsInCache(const ClipRectsContext& context,
ClipRects* parentClipRects, const ClipRects& clipRects) const |
125 { | 125 { |
126 ClipRectsCache::Entry& entry = cache().get(context.cacheSlot); | 126 ClipRectsCache::Entry& entry = cache().get(context.cacheSlot); |
127 entry.root = context.rootLayer; | 127 entry.root = context.rootLayer; |
128 #if ENABLE(ASSERT) | 128 #if ENABLE(ASSERT) |
129 entry.scrollbarRelevancy = context.scrollbarRelevancy; | 129 entry.scrollbarRelevancy = context.scrollbarRelevancy; |
130 #endif | 130 #endif |
131 | 131 |
132 if (parentClipRects) { | 132 if (parentClipRects) { |
133 // If our clip rects match the clip rects of our parent, we share storag
e. | 133 // If our clip rects match the clip rects of our parent, we share storag
e. |
134 if (clipRects == *parentClipRects) { | 134 if (clipRects == *parentClipRects) { |
135 entry.clipRects = parentClipRects; | 135 entry.clipRects = parentClipRects; |
136 return parentClipRects; | 136 return parentClipRects; |
137 } | 137 } |
138 } | 138 } |
139 | 139 |
140 entry.clipRects = ClipRects::create(clipRects); | 140 entry.clipRects = ClipRects::create(clipRects); |
141 return entry.clipRects.get(); | 141 return entry.clipRects.get(); |
142 } | 142 } |
143 | 143 |
144 ClipRects* RenderLayerClipper::getClipRects(const ClipRectsContext& context) con
st | 144 ClipRects* LayerClipper::getClipRects(const ClipRectsContext& context) const |
145 { | 145 { |
146 if (ClipRects* result = clipRectsIfCached(context)) | 146 if (ClipRects* result = clipRectsIfCached(context)) |
147 return result; | 147 return result; |
148 | 148 |
149 // Note that it's important that we call getClipRects on our parent | 149 // Note that it's important that we call getClipRects on our parent |
150 // before we call calculateClipRects so that calculateClipRects will hit | 150 // before we call calculateClipRects so that calculateClipRects will hit |
151 // the cache. | 151 // the cache. |
152 ClipRects* parentClipRects = 0; | 152 ClipRects* parentClipRects = 0; |
153 if (context.rootLayer != m_renderer.layer() && m_renderer.layer()->parent()) | 153 if (context.rootLayer != m_renderer.layer() && m_renderer.layer()->parent()) |
154 parentClipRects = m_renderer.layer()->parent()->clipper().getClipRects(c
ontext); | 154 parentClipRects = m_renderer.layer()->parent()->clipper().getClipRects(c
ontext); |
155 | 155 |
156 RefPtr<ClipRects> clipRects = ClipRects::create(); | 156 RefPtr<ClipRects> clipRects = ClipRects::create(); |
157 calculateClipRects(context, *clipRects); | 157 calculateClipRects(context, *clipRects); |
158 return storeClipRectsInCache(context, parentClipRects, *clipRects); | 158 return storeClipRectsInCache(context, parentClipRects, *clipRects); |
159 } | 159 } |
160 | 160 |
161 void RenderLayerClipper::clearClipRectsIncludingDescendants() | 161 void LayerClipper::clearClipRectsIncludingDescendants() |
162 { | 162 { |
163 m_cache = nullptr; | 163 m_cache = nullptr; |
164 | 164 |
165 for (RenderLayer* layer = m_renderer.layer()->firstChild(); layer; layer = l
ayer->nextSibling()) | 165 for (Layer* layer = m_renderer.layer()->firstChild(); layer; layer = layer->
nextSibling()) |
166 layer->clipper().clearClipRectsIncludingDescendants(); | 166 layer->clipper().clearClipRectsIncludingDescendants(); |
167 } | 167 } |
168 | 168 |
169 void RenderLayerClipper::clearClipRectsIncludingDescendants(ClipRectsCacheSlot c
acheSlot) | 169 void LayerClipper::clearClipRectsIncludingDescendants(ClipRectsCacheSlot cacheSl
ot) |
170 { | 170 { |
171 if (m_cache) | 171 if (m_cache) |
172 m_cache->clear(cacheSlot); | 172 m_cache->clear(cacheSlot); |
173 | 173 |
174 for (RenderLayer* layer = m_renderer.layer()->firstChild(); layer; layer = l
ayer->nextSibling()) | 174 for (Layer* layer = m_renderer.layer()->firstChild(); layer; layer = layer->
nextSibling()) |
175 layer->clipper().clearClipRectsIncludingDescendants(cacheSlot); | 175 layer->clipper().clearClipRectsIncludingDescendants(cacheSlot); |
176 } | 176 } |
177 | 177 |
178 LayoutRect RenderLayerClipper::childrenClipRect() const | 178 LayoutRect LayerClipper::childrenClipRect() const |
179 { | 179 { |
180 // FIXME: border-radius not accounted for. | 180 // FIXME: border-radius not accounted for. |
181 // FIXME: Regions not accounted for. | 181 // FIXME: Regions not accounted for. |
182 RenderLayer* clippingRootLayer = clippingRootForPainting(); | 182 Layer* clippingRootLayer = clippingRootForPainting(); |
183 LayoutRect layerBounds; | 183 LayoutRect layerBounds; |
184 ClipRect backgroundRect, foregroundRect, outlineRect; | 184 ClipRect backgroundRect, foregroundRect, outlineRect; |
185 // Need to use uncached clip rects, because the value of 'dontClipToOverflow
' may be different from the painting path (<rdar://problem/11844909>). | 185 // Need to use uncached clip rects, because the value of 'dontClipToOverflow
' may be different from the painting path (<rdar://problem/11844909>). |
186 ClipRectsContext context(clippingRootLayer, UncachedClipRects); | 186 ClipRectsContext context(clippingRootLayer, UncachedClipRects); |
187 calculateRects(context, m_renderer.view()->unscaledDocumentRect(), layerBoun
ds, backgroundRect, foregroundRect, outlineRect); | 187 calculateRects(context, m_renderer.view()->unscaledDocumentRect(), layerBoun
ds, backgroundRect, foregroundRect, outlineRect); |
188 return clippingRootLayer->renderer()->localToAbsoluteQuad(FloatQuad(foregrou
ndRect.rect())).enclosingBoundingBox(); | 188 return clippingRootLayer->renderer()->localToAbsoluteQuad(FloatQuad(foregrou
ndRect.rect())).enclosingBoundingBox(); |
189 } | 189 } |
190 | 190 |
191 LayoutRect RenderLayerClipper::localClipRect() const | 191 LayoutRect LayerClipper::localClipRect() const |
192 { | 192 { |
193 // FIXME: border-radius not accounted for. | 193 // FIXME: border-radius not accounted for. |
194 RenderLayer* clippingRootLayer = clippingRootForPainting(); | 194 Layer* clippingRootLayer = clippingRootForPainting(); |
195 LayoutRect layerBounds; | 195 LayoutRect layerBounds; |
196 ClipRect backgroundRect, foregroundRect, outlineRect; | 196 ClipRect backgroundRect, foregroundRect, outlineRect; |
197 ClipRectsContext context(clippingRootLayer, PaintingClipRects); | 197 ClipRectsContext context(clippingRootLayer, PaintingClipRects); |
198 calculateRects(context, LayoutRect::infiniteIntRect(), layerBounds, backgrou
ndRect, foregroundRect, outlineRect); | 198 calculateRects(context, LayoutRect::infiniteIntRect(), layerBounds, backgrou
ndRect, foregroundRect, outlineRect); |
199 | 199 |
200 LayoutRect clipRect = backgroundRect.rect(); | 200 LayoutRect clipRect = backgroundRect.rect(); |
201 if (clipRect == LayoutRect::infiniteIntRect()) | 201 if (clipRect == LayoutRect::infiniteIntRect()) |
202 return clipRect; | 202 return clipRect; |
203 | 203 |
204 LayoutPoint clippingRootOffset; | 204 LayoutPoint clippingRootOffset; |
205 m_renderer.layer()->convertToLayerCoords(clippingRootLayer, clippingRootOffs
et); | 205 m_renderer.layer()->convertToLayerCoords(clippingRootLayer, clippingRootOffs
et); |
206 clipRect.moveBy(-clippingRootOffset); | 206 clipRect.moveBy(-clippingRootOffset); |
207 | 207 |
208 return clipRect; | 208 return clipRect; |
209 } | 209 } |
210 | 210 |
211 void RenderLayerClipper::calculateRects(const ClipRectsContext& context, const L
ayoutRect& paintDirtyRect, LayoutRect& layerBounds, | 211 void LayerClipper::calculateRects(const ClipRectsContext& context, const LayoutR
ect& paintDirtyRect, LayoutRect& layerBounds, |
212 ClipRect& backgroundRect, ClipRect& foregroundRect, ClipRect& outlineRect, c
onst LayoutPoint* offsetFromRoot) const | 212 ClipRect& backgroundRect, ClipRect& foregroundRect, ClipRect& outlineRect, c
onst LayoutPoint* offsetFromRoot) const |
213 { | 213 { |
214 bool isClippingRoot = m_renderer.layer() == context.rootLayer; | 214 bool isClippingRoot = m_renderer.layer() == context.rootLayer; |
215 | 215 |
216 if (!isClippingRoot && m_renderer.layer()->parent()) { | 216 if (!isClippingRoot && m_renderer.layer()->parent()) { |
217 backgroundRect = backgroundClipRect(context); | 217 backgroundRect = backgroundClipRect(context); |
218 backgroundRect.move(roundedIntSize(context.subPixelAccumulation)); | 218 backgroundRect.move(roundedIntSize(context.subPixelAccumulation)); |
219 backgroundRect.intersect(paintDirtyRect); | 219 backgroundRect.intersect(paintDirtyRect); |
220 } else { | 220 } else { |
221 backgroundRect = paintDirtyRect; | 221 backgroundRect = paintDirtyRect; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 // CSS clip (different than clipping due to overflow) can clip to any box, e
ven if it falls outside of the border box. | 264 // CSS clip (different than clipping due to overflow) can clip to any box, e
ven if it falls outside of the border box. |
265 if (m_renderer.hasClip()) { | 265 if (m_renderer.hasClip()) { |
266 // Clip applies to *us* as well, so go ahead and update the damageRect. | 266 // Clip applies to *us* as well, so go ahead and update the damageRect. |
267 LayoutRect newPosClip = toRenderBox(m_renderer).clipRect(offset); | 267 LayoutRect newPosClip = toRenderBox(m_renderer).clipRect(offset); |
268 backgroundRect.intersect(newPosClip); | 268 backgroundRect.intersect(newPosClip); |
269 foregroundRect.intersect(newPosClip); | 269 foregroundRect.intersect(newPosClip); |
270 outlineRect.intersect(newPosClip); | 270 outlineRect.intersect(newPosClip); |
271 } | 271 } |
272 } | 272 } |
273 | 273 |
274 void RenderLayerClipper::calculateClipRects(const ClipRectsContext& context, Cli
pRects& clipRects) const | 274 void LayerClipper::calculateClipRects(const ClipRectsContext& context, ClipRects
& clipRects) const |
275 { | 275 { |
276 bool rootLayerScrolls = m_renderer.document().settings() && m_renderer.docum
ent().settings()->rootLayerScrolls(); | 276 bool rootLayerScrolls = m_renderer.document().settings() && m_renderer.docum
ent().settings()->rootLayerScrolls(); |
277 if (!m_renderer.layer()->parent() && !rootLayerScrolls) { | 277 if (!m_renderer.layer()->parent() && !rootLayerScrolls) { |
278 // The root layer's clip rect is always infinite. | 278 // The root layer's clip rect is always infinite. |
279 clipRects.reset(LayoutRect::infiniteIntRect()); | 279 clipRects.reset(LayoutRect::infiniteIntRect()); |
280 return; | 280 return; |
281 } | 281 } |
282 | 282 |
283 bool isClippingRoot = m_renderer.layer() == context.rootLayer; | 283 bool isClippingRoot = m_renderer.layer() == context.rootLayer; |
284 | 284 |
285 // For transformed layers, the root layer was shifted to be us, so there is
no need to | 285 // For transformed layers, the root layer was shifted to be us, so there is
no need to |
286 // examine the parent. We want to cache clip rects with us as the root. | 286 // examine the parent. We want to cache clip rects with us as the root. |
287 RenderLayer* parentLayer = !isClippingRoot ? m_renderer.layer()->parent() :
0; | 287 Layer* parentLayer = !isClippingRoot ? m_renderer.layer()->parent() : 0; |
288 | 288 |
289 // Ensure that our parent's clip has been calculated so that we can examine
the values. | 289 // Ensure that our parent's clip has been calculated so that we can examine
the values. |
290 if (parentLayer) { | 290 if (parentLayer) { |
291 // FIXME: Why don't we just call getClipRects here? | 291 // FIXME: Why don't we just call getClipRects here? |
292 if (context.usesCache() && parentLayer->clipper().cachedClipRects(contex
t)) { | 292 if (context.usesCache() && parentLayer->clipper().cachedClipRects(contex
t)) { |
293 clipRects = *parentLayer->clipper().cachedClipRects(context); | 293 clipRects = *parentLayer->clipper().cachedClipRects(context); |
294 } else { | 294 } else { |
295 parentLayer->clipper().calculateClipRects(context, clipRects); | 295 parentLayer->clipper().calculateClipRects(context, clipRects); |
296 } | 296 } |
297 } else { | 297 } else { |
298 clipRects.reset(LayoutRect::infiniteIntRect()); | 298 clipRects.reset(LayoutRect::infiniteIntRect()); |
299 } | 299 } |
300 | 300 |
301 adjustClipRectsForChildren(m_renderer, clipRects); | 301 adjustClipRectsForChildren(m_renderer, clipRects); |
302 | 302 |
303 if ((m_renderer.hasOverflowClip() && (context.respectOverflowClip == Respect
OverflowClip || !isClippingRoot)) || m_renderer.hasClip()) { | 303 if ((m_renderer.hasOverflowClip() && (context.respectOverflowClip == Respect
OverflowClip || !isClippingRoot)) || m_renderer.hasClip()) { |
304 // This offset cannot use convertToLayerCoords, because sometimes our ro
otLayer may be across | 304 // This offset cannot use convertToLayerCoords, because sometimes our ro
otLayer may be across |
305 // some transformed layer boundary, for example, in the RenderLayerCompo
sitor overlapMap, where | 305 // some transformed layer boundary, for example, in the LayerCompositor
overlapMap, where |
306 // clipRects are needed in view space. | 306 // clipRects are needed in view space. |
307 applyClipRects(context, m_renderer, roundedLayoutPoint(m_renderer.localT
oContainerPoint(FloatPoint(), context.rootLayer->renderer())), clipRects); | 307 applyClipRects(context, m_renderer, roundedLayoutPoint(m_renderer.localT
oContainerPoint(FloatPoint(), context.rootLayer->renderer())), clipRects); |
308 } | 308 } |
309 } | 309 } |
310 | 310 |
311 static ClipRect backgroundClipRectForPosition(const ClipRects& parentRects, EPos
ition position) | 311 static ClipRect backgroundClipRectForPosition(const ClipRects& parentRects, EPos
ition position) |
312 { | 312 { |
313 if (position == FixedPosition) | 313 if (position == FixedPosition) |
314 return parentRects.fixedClipRect(); | 314 return parentRects.fixedClipRect(); |
315 | 315 |
316 if (position == AbsolutePosition) | 316 if (position == AbsolutePosition) |
317 return parentRects.posClipRect(); | 317 return parentRects.posClipRect(); |
318 | 318 |
319 return parentRects.overflowClipRect(); | 319 return parentRects.overflowClipRect(); |
320 } | 320 } |
321 | 321 |
322 ClipRect RenderLayerClipper::backgroundClipRect(const ClipRectsContext& context)
const | 322 ClipRect LayerClipper::backgroundClipRect(const ClipRectsContext& context) const |
323 { | 323 { |
324 ASSERT(m_renderer.layer()->parent()); | 324 ASSERT(m_renderer.layer()->parent()); |
325 ASSERT(m_renderer.view()); | 325 ASSERT(m_renderer.view()); |
326 | 326 |
327 RefPtr<ClipRects> parentClipRects = ClipRects::create(); | 327 RefPtr<ClipRects> parentClipRects = ClipRects::create(); |
328 if (m_renderer.layer() == context.rootLayer) | 328 if (m_renderer.layer() == context.rootLayer) |
329 parentClipRects->reset(LayoutRect::infiniteIntRect()); | 329 parentClipRects->reset(LayoutRect::infiniteIntRect()); |
330 else | 330 else |
331 m_renderer.layer()->parent()->clipper().getOrCalculateClipRects(context,
*parentClipRects); | 331 m_renderer.layer()->parent()->clipper().getOrCalculateClipRects(context,
*parentClipRects); |
332 | 332 |
333 ClipRect result = backgroundClipRectForPosition(*parentClipRects, m_renderer
.style()->position()); | 333 ClipRect result = backgroundClipRectForPosition(*parentClipRects, m_renderer
.style()->position()); |
334 | 334 |
335 // Note: infinite clipRects should not be scrolled here, otherwise they will
accidentally no longer be considered infinite. | 335 // Note: infinite clipRects should not be scrolled here, otherwise they will
accidentally no longer be considered infinite. |
336 if (parentClipRects->fixed() && context.rootLayer->renderer() == m_renderer.
view() && result != LayoutRect::infiniteIntRect()) | 336 if (parentClipRects->fixed() && context.rootLayer->renderer() == m_renderer.
view() && result != LayoutRect::infiniteIntRect()) |
337 result.move(m_renderer.view()->frameView()->scrollOffsetForViewportConst
rainedObjects()); | 337 result.move(m_renderer.view()->frameView()->scrollOffsetForViewportConst
rainedObjects()); |
338 | 338 |
339 return result; | 339 return result; |
340 } | 340 } |
341 | 341 |
342 void RenderLayerClipper::getOrCalculateClipRects(const ClipRectsContext& context
, ClipRects& clipRects) const | 342 void LayerClipper::getOrCalculateClipRects(const ClipRectsContext& context, Clip
Rects& clipRects) const |
343 { | 343 { |
344 if (context.usesCache()) | 344 if (context.usesCache()) |
345 clipRects = *getClipRects(context); | 345 clipRects = *getClipRects(context); |
346 else | 346 else |
347 calculateClipRects(context, clipRects); | 347 calculateClipRects(context, clipRects); |
348 } | 348 } |
349 | 349 |
350 RenderLayer* RenderLayerClipper::clippingRootForPainting() const | 350 Layer* LayerClipper::clippingRootForPainting() const |
351 { | 351 { |
352 const RenderLayer* current = m_renderer.layer(); | 352 const Layer* current = m_renderer.layer(); |
353 // FIXME: getting rid of current->hasCompositedLayerMapping() here breaks th
e | 353 // FIXME: getting rid of current->hasCompositedLayerMapping() here breaks th
e |
354 // compositing/backing/no-backing-for-clip.html layout test, because there i
s a | 354 // compositing/backing/no-backing-for-clip.html layout test, because there i
s a |
355 // "composited but paints into ancestor" layer involved. However, it doesn't
make sense that | 355 // "composited but paints into ancestor" layer involved. However, it doesn't
make sense that |
356 // that check would be appropriate here but not inside the while loop below. | 356 // that check would be appropriate here but not inside the while loop below. |
357 if (current->isPaintInvalidationContainer() || current->hasCompositedLayerMa
pping()) | 357 if (current->isPaintInvalidationContainer() || current->hasCompositedLayerMa
pping()) |
358 return const_cast<RenderLayer*>(current); | 358 return const_cast<Layer*>(current); |
359 | 359 |
360 while (current) { | 360 while (current) { |
361 if (current->isRootLayer()) | 361 if (current->isRootLayer()) |
362 return const_cast<RenderLayer*>(current); | 362 return const_cast<Layer*>(current); |
363 | 363 |
364 current = current->compositingContainer(); | 364 current = current->compositingContainer(); |
365 ASSERT(current); | 365 ASSERT(current); |
366 if (current->transform() || current->isPaintInvalidationContainer()) | 366 if (current->transform() || current->isPaintInvalidationContainer()) |
367 return const_cast<RenderLayer*>(current); | 367 return const_cast<Layer*>(current); |
368 } | 368 } |
369 | 369 |
370 ASSERT_NOT_REACHED(); | 370 ASSERT_NOT_REACHED(); |
371 return 0; | 371 return 0; |
372 } | 372 } |
373 | 373 |
374 } // namespace blink | 374 } // namespace blink |
OLD | NEW |