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 26 matching lines...) Expand all Loading... |
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/rendering/RenderLayerClipper.h" |
46 | 46 |
| 47 #include "core/frame/Settings.h" |
47 #include "core/rendering/RenderLayer.h" | 48 #include "core/rendering/RenderLayer.h" |
48 #include "core/rendering/RenderView.h" | 49 #include "core/rendering/RenderView.h" |
49 | 50 |
50 namespace blink { | 51 namespace blink { |
51 | 52 |
52 static void adjustClipRectsForChildren(const RenderObject& renderer, ClipRects&
clipRects) | 53 static void adjustClipRectsForChildren(const RenderObject& renderer, ClipRects&
clipRects) |
53 { | 54 { |
54 EPosition position = renderer.style()->position(); | 55 EPosition position = renderer.style()->position(); |
55 // 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 |
56 // 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
. |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 // 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. |
266 LayoutRect newPosClip = toRenderBox(m_renderer).clipRect(offset); | 267 LayoutRect newPosClip = toRenderBox(m_renderer).clipRect(offset); |
267 backgroundRect.intersect(newPosClip); | 268 backgroundRect.intersect(newPosClip); |
268 foregroundRect.intersect(newPosClip); | 269 foregroundRect.intersect(newPosClip); |
269 outlineRect.intersect(newPosClip); | 270 outlineRect.intersect(newPosClip); |
270 } | 271 } |
271 } | 272 } |
272 | 273 |
273 void RenderLayerClipper::calculateClipRects(const ClipRectsContext& context, Cli
pRects& clipRects) const | 274 void RenderLayerClipper::calculateClipRects(const ClipRectsContext& context, Cli
pRects& clipRects) const |
274 { | 275 { |
275 if (!m_renderer.layer()->parent()) { | 276 bool rootLayerScrolls = m_renderer.document().settings() && m_renderer.docum
ent().settings()->rootLayerScrolls(); |
| 277 if (!m_renderer.layer()->parent() && !rootLayerScrolls) { |
276 // The root layer's clip rect is always infinite. | 278 // The root layer's clip rect is always infinite. |
277 clipRects.reset(PaintInfo::infiniteRect()); | 279 clipRects.reset(PaintInfo::infiniteRect()); |
278 return; | 280 return; |
279 } | 281 } |
280 | 282 |
281 bool isClippingRoot = m_renderer.layer() == context.rootLayer; | 283 bool isClippingRoot = m_renderer.layer() == context.rootLayer; |
282 | 284 |
283 // 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 |
284 // 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. |
285 RenderLayer* parentLayer = !isClippingRoot ? m_renderer.layer()->parent() :
0; | 287 RenderLayer* parentLayer = !isClippingRoot ? m_renderer.layer()->parent() :
0; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 ASSERT(current); | 366 ASSERT(current); |
365 if (current->transform() || current->isPaintInvalidationContainer()) | 367 if (current->transform() || current->isPaintInvalidationContainer()) |
366 return const_cast<RenderLayer*>(current); | 368 return const_cast<RenderLayer*>(current); |
367 } | 369 } |
368 | 370 |
369 ASSERT_NOT_REACHED(); | 371 ASSERT_NOT_REACHED(); |
370 return 0; | 372 return 0; |
371 } | 373 } |
372 | 374 |
373 } // namespace blink | 375 } // namespace blink |
OLD | NEW |