| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "core/rendering/RenderLayerClipper.h" | 45 #include "core/rendering/RenderLayerClipper.h" |
| 46 | 46 |
| 47 #include "core/rendering/RenderLayer.h" | 47 #include "core/rendering/RenderLayer.h" |
| 48 #include "core/rendering/RenderView.h" | 48 #include "core/rendering/RenderView.h" |
| 49 | 49 |
| 50 namespace blink { | 50 namespace blink { |
| 51 | 51 |
| 52 static void adjustClipRectsForChildren(const RenderObject& renderer, ClipRects&
clipRects) | 52 static void adjustClipRectsForChildren(const RenderObject& renderer, ClipRects&
clipRects) |
| 53 { | 53 { |
| 54 EPosition position = renderer.style()->position(); | 54 EPosition position = renderer.style()->position(); |
| 55 // A fixed object is essentially the root of its containing block hierarchy,
so when | 55 if (position == RelativePosition) { |
| 56 // we encounter such an object, we reset our clip rects to the fixedClipRect
. | |
| 57 if (position == FixedPosition) { | |
| 58 clipRects.setPosClipRect(clipRects.fixedClipRect()); | |
| 59 clipRects.setOverflowClipRect(clipRects.fixedClipRect()); | |
| 60 clipRects.setFixed(true); | |
| 61 } else if (position == RelativePosition) { | |
| 62 clipRects.setPosClipRect(clipRects.overflowClipRect()); | 56 clipRects.setPosClipRect(clipRects.overflowClipRect()); |
| 63 } else if (position == AbsolutePosition) { | 57 } else if (position == AbsolutePosition) { |
| 64 clipRects.setOverflowClipRect(clipRects.posClipRect()); | 58 clipRects.setOverflowClipRect(clipRects.posClipRect()); |
| 65 } | 59 } |
| 66 } | 60 } |
| 67 | 61 |
| 68 static void applyClipRects(const ClipRectsContext& context, RenderObject& render
er, LayoutPoint offset, ClipRects& clipRects) | 62 static void applyClipRects(const ClipRectsContext& context, RenderObject& render
er, LayoutPoint offset, ClipRects& clipRects) |
| 69 { | 63 { |
| 70 ASSERT(renderer.hasOverflowClip() || renderer.hasClip()); | 64 ASSERT(renderer.hasOverflowClip() || renderer.hasClip()); |
| 71 | 65 |
| 72 if (renderer.hasOverflowClip()) { | 66 if (renderer.hasOverflowClip()) { |
| 73 ClipRect newOverflowClip = toRenderBox(renderer).overflowClipRect(offset
, context.scrollbarRelevancy); | 67 ClipRect newOverflowClip = toRenderBox(renderer).overflowClipRect(offset
, context.scrollbarRelevancy); |
| 74 newOverflowClip.setHasRadius(renderer.style()->hasBorderRadius()); | 68 newOverflowClip.setHasRadius(renderer.style()->hasBorderRadius()); |
| 75 clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.ov
erflowClipRect())); | 69 clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.ov
erflowClipRect())); |
| 76 if (renderer.isPositioned()) | 70 if (renderer.isPositioned()) |
| 77 clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.pos
ClipRect())); | 71 clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.pos
ClipRect())); |
| 78 } | 72 } |
| 79 | 73 |
| 80 if (renderer.hasClip()) { | 74 if (renderer.hasClip()) { |
| 81 LayoutRect newClip = toRenderBox(renderer).clipRect(offset); | 75 LayoutRect newClip = toRenderBox(renderer).clipRect(offset); |
| 82 clipRects.setPosClipRect(intersection(newClip, clipRects.posClipRect()))
; | 76 clipRects.setPosClipRect(intersection(newClip, clipRects.posClipRect()))
; |
| 83 clipRects.setOverflowClipRect(intersection(newClip, clipRects.overflowCl
ipRect())); | 77 clipRects.setOverflowClipRect(intersection(newClip, clipRects.overflowCl
ipRect())); |
| 84 clipRects.setFixedClipRect(intersection(newClip, clipRects.fixedClipRect
())); | |
| 85 } | 78 } |
| 86 } | 79 } |
| 87 | 80 |
| 88 RenderLayerClipper::RenderLayerClipper(RenderLayerModelObject& renderer) | 81 RenderLayerClipper::RenderLayerClipper(RenderLayerModelObject& renderer) |
| 89 : m_renderer(renderer) | 82 : m_renderer(renderer) |
| 90 { | 83 { |
| 91 } | 84 } |
| 92 | 85 |
| 93 ClipRects* RenderLayerClipper::clipRectsIfCached(const ClipRectsContext& context
) const | 86 ClipRects* RenderLayerClipper::clipRectsIfCached(const ClipRectsContext& context
) const |
| 94 { | 87 { |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 if ((m_renderer.hasOverflowClip() && (context.respectOverflowClip == Respect
OverflowClip || !isClippingRoot)) || m_renderer.hasClip()) { | 290 if ((m_renderer.hasOverflowClip() && (context.respectOverflowClip == Respect
OverflowClip || !isClippingRoot)) || m_renderer.hasClip()) { |
| 298 // This offset cannot use convertToLayerCoords, because sometimes our ro
otLayer may be across | 291 // This offset cannot use convertToLayerCoords, because sometimes our ro
otLayer may be across |
| 299 // some transformed layer boundary, for example, in the RenderLayerCompo
sitor overlapMap, where | 292 // some transformed layer boundary, for example, in the RenderLayerCompo
sitor overlapMap, where |
| 300 // clipRects are needed in view space. | 293 // clipRects are needed in view space. |
| 301 applyClipRects(context, m_renderer, roundedLayoutPoint(m_renderer.localT
oContainerPoint(FloatPoint(), context.rootLayer->renderer())), clipRects); | 294 applyClipRects(context, m_renderer, roundedLayoutPoint(m_renderer.localT
oContainerPoint(FloatPoint(), context.rootLayer->renderer())), clipRects); |
| 302 } | 295 } |
| 303 } | 296 } |
| 304 | 297 |
| 305 static ClipRect backgroundClipRectForPosition(const ClipRects& parentRects, EPos
ition position) | 298 static ClipRect backgroundClipRectForPosition(const ClipRects& parentRects, EPos
ition position) |
| 306 { | 299 { |
| 307 if (position == FixedPosition) | |
| 308 return parentRects.fixedClipRect(); | |
| 309 | |
| 310 if (position == AbsolutePosition) | 300 if (position == AbsolutePosition) |
| 311 return parentRects.posClipRect(); | 301 return parentRects.posClipRect(); |
| 312 | |
| 313 return parentRects.overflowClipRect(); | 302 return parentRects.overflowClipRect(); |
| 314 } | 303 } |
| 315 | 304 |
| 316 ClipRect RenderLayerClipper::backgroundClipRect(const ClipRectsContext& context)
const | 305 ClipRect RenderLayerClipper::backgroundClipRect(const ClipRectsContext& context)
const |
| 317 { | 306 { |
| 318 ASSERT(m_renderer.layer()->parent()); | 307 ASSERT(m_renderer.layer()->parent()); |
| 319 ASSERT(m_renderer.view()); | 308 ASSERT(m_renderer.view()); |
| 320 | 309 |
| 321 ClipRects parentClipRects; | 310 ClipRects parentClipRects; |
| 322 if (m_renderer.layer() == context.rootLayer) | 311 if (m_renderer.layer() == context.rootLayer) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 353 ASSERT(current); | 342 ASSERT(current); |
| 354 if (current->transform() || current->isPaintInvalidationContainer()) | 343 if (current->transform() || current->isPaintInvalidationContainer()) |
| 355 return const_cast<RenderLayer*>(current); | 344 return const_cast<RenderLayer*>(current); |
| 356 } | 345 } |
| 357 | 346 |
| 358 ASSERT_NOT_REACHED(); | 347 ASSERT_NOT_REACHED(); |
| 359 return 0; | 348 return 0; |
| 360 } | 349 } |
| 361 | 350 |
| 362 } // namespace blink | 351 } // namespace blink |
| OLD | NEW |