| 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 LayoutPoint offset; | 227 LayoutPoint offset; |
| 228 if (offsetFromRoot) | 228 if (offsetFromRoot) |
| 229 offset = *offsetFromRoot; | 229 offset = *offsetFromRoot; |
| 230 else | 230 else |
| 231 m_layoutObject.layer()->convertToLayerCoords(context.rootLayer, offset); | 231 m_layoutObject.layer()->convertToLayerCoords(context.rootLayer, offset); |
| 232 layerBounds = LayoutRect(offset, LayoutSize(m_layoutObject.layer()->size()))
; | 232 layerBounds = LayoutRect(offset, LayoutSize(m_layoutObject.layer()->size()))
; |
| 233 | 233 |
| 234 // Update the clip rects that will be passed to child layers. | 234 // Update the clip rects that will be passed to child layers. |
| 235 if (m_layoutObject.hasOverflowClip()) { | 235 if (m_layoutObject.hasOverflowClip()) { |
| 236 // This layer establishes a clip of some kind. | 236 // This layer establishes a clip of some kind. |
| 237 if (!isClippingRoot || context.respectOverflowClip == RespectOverflowCli
p) { | 237 if (shouldRespectOverflowClip(context)) { |
| 238 foregroundRect.intersect(toLayoutBox(m_layoutObject).overflowClipRec
t(offset, context.scrollbarRelevancy)); | 238 foregroundRect.intersect(toLayoutBox(m_layoutObject).overflowClipRec
t(offset, context.scrollbarRelevancy)); |
| 239 if (m_layoutObject.style()->hasBorderRadius()) | 239 if (m_layoutObject.style()->hasBorderRadius()) |
| 240 foregroundRect.setHasRadius(true); | 240 foregroundRect.setHasRadius(true); |
| 241 } | 241 } |
| 242 | 242 |
| 243 // If we establish an overflow clip at all, then go ahead and make sure
our background | 243 // If we establish an overflow clip at all, then go ahead and make sure
our background |
| 244 // rect is intersected with our layer's bounds including our visual over
flow, | 244 // rect is intersected with our layer's bounds including our visual over
flow, |
| 245 // since any visual overflow like box-shadow or border-outset is not cli
pped by overflow:auto/hidden. | 245 // since any visual overflow like box-shadow or border-outset is not cli
pped by overflow:auto/hidden. |
| 246 if (toLayoutBox(m_layoutObject).hasVisualOverflow()) { | 246 if (toLayoutBox(m_layoutObject).hasVisualOverflow()) { |
| 247 // FIXME: Perhaps we should be propagating the borderbox as the clip
rect for children, even though | 247 // FIXME: Perhaps we should be propagating the borderbox as the clip
rect for children, even though |
| 248 // we may need to inflate our clip specifically for shadows o
r outsets. | 248 // we may need to inflate our clip specifically for shadows o
r outsets. |
| 249 // FIXME: Does not do the right thing with columns yet, since we don
't yet factor in the | 249 // FIXME: Does not do the right thing with columns yet, since we don
't yet factor in the |
| 250 // individual column boxes as overflow. | 250 // individual column boxes as overflow. |
| 251 LayoutRect layerBoundsWithVisualOverflow = toLayoutBox(m_layoutObjec
t).visualOverflowRect(); | 251 LayoutRect layerBoundsWithVisualOverflow = toLayoutBox(m_layoutObjec
t).visualOverflowRect(); |
| 252 toLayoutBox(m_layoutObject).flipForWritingMode(layerBoundsWithVisual
Overflow); // DeprecatedPaintLayer are in physical coordinates, so the overflow
has to be flipped. | 252 toLayoutBox(m_layoutObject).flipForWritingMode(layerBoundsWithVisual
Overflow); // DeprecatedPaintLayer are in physical coordinates, so the overflow
has to be flipped. |
| 253 layerBoundsWithVisualOverflow.moveBy(offset); | 253 layerBoundsWithVisualOverflow.moveBy(offset); |
| 254 if (!isClippingRoot || context.respectOverflowClip == RespectOverflo
wClip) | 254 if (shouldRespectOverflowClip(context)) |
| 255 backgroundRect.intersect(layerBoundsWithVisualOverflow); | 255 backgroundRect.intersect(layerBoundsWithVisualOverflow); |
| 256 } else { | 256 } else { |
| 257 LayoutRect bounds = toLayoutBox(m_layoutObject).borderBoxRect(); | 257 LayoutRect bounds = toLayoutBox(m_layoutObject).borderBoxRect(); |
| 258 bounds.moveBy(offset); | 258 bounds.moveBy(offset); |
| 259 if (!isClippingRoot || context.respectOverflowClip == RespectOverflo
wClip) | 259 if (shouldRespectOverflowClip(context)) |
| 260 backgroundRect.intersect(bounds); | 260 backgroundRect.intersect(bounds); |
| 261 } | 261 } |
| 262 } | 262 } |
| 263 | 263 |
| 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_layoutObject.hasClip()) { | 265 if (m_layoutObject.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 = toLayoutBox(m_layoutObject).clipRect(offset); | 267 LayoutRect newPosClip = toLayoutBox(m_layoutObject).clipRect(offset); |
| 268 backgroundRect.intersect(newPosClip); | 268 backgroundRect.intersect(newPosClip); |
| 269 foregroundRect.intersect(newPosClip); | 269 foregroundRect.intersect(newPosClip); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 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(LayoutRect::infiniteIntRect())); | 298 clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect())); |
| 299 } | 299 } |
| 300 | 300 |
| 301 adjustClipRectsForChildren(m_layoutObject, clipRects); | 301 adjustClipRectsForChildren(m_layoutObject, clipRects); |
| 302 | 302 |
| 303 if ((m_layoutObject.hasOverflowClip() && (context.respectOverflowClip == Res
pectOverflowClip || !isClippingRoot)) || m_layoutObject.hasClip()) { | 303 if ((m_layoutObject.hasOverflowClip() && shouldRespectOverflowClip(context))
|| m_layoutObject.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 DeprecatedPaintL
ayerCompositor overlapMap, where | 305 // some transformed layer boundary, for example, in the DeprecatedPaintL
ayerCompositor overlapMap, where |
| 306 // clipRects are needed in view space. | 306 // clipRects are needed in view space. |
| 307 applyClipRects(context, m_layoutObject, roundedLayoutPoint(m_layoutObjec
t.localToContainerPoint(FloatPoint(), context.rootLayer->layoutObject())), clipR
ects); | 307 applyClipRects(context, m_layoutObject, roundedLayoutPoint(m_layoutObjec
t.localToContainerPoint(FloatPoint(), context.rootLayer->layoutObject())), clipR
ects); |
| 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) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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<DeprecatedPaintLayer*>(current); | 367 return const_cast<DeprecatedPaintLayer*>(current); |
| 368 } | 368 } |
| 369 | 369 |
| 370 ASSERT_NOT_REACHED(); | 370 ASSERT_NOT_REACHED(); |
| 371 return 0; | 371 return 0; |
| 372 } | 372 } |
| 373 | 373 |
| 374 bool DeprecatedPaintLayerClipper::shouldRespectOverflowClip(const ClipRectsConte
xt& context) const |
| 375 { |
| 376 DeprecatedPaintLayer* layer = m_layoutObject.layer(); |
| 377 if (layer != context.rootLayer) |
| 378 return true; |
| 379 |
| 380 if (context.respectOverflowClip == IgnoreOverflowClip) |
| 381 return false; |
| 382 |
| 383 if (layer->isRootLayer() && context.respectOverflowClipForViewport == Ignore
OverflowClip) |
| 384 return false; |
| 385 |
| 386 return true; |
| 387 } |
| 388 |
| 374 } // namespace blink | 389 } // namespace blink |
| OLD | NEW |