Index: Source/core/rendering/RenderLayer.cpp |
diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp |
index 014321da993929f0e43b8c59ba9dad1d5a444a5b..81ad5c1978f6de26ab16a5710a71b2554c450e72 100644 |
--- a/Source/core/rendering/RenderLayer.cpp |
+++ b/Source/core/rendering/RenderLayer.cpp |
@@ -5000,26 +5000,20 @@ void RenderLayer::calculateRects(const ClipRectsContext& clipRectsContext, const |
layerBounds = LayoutRect(offset, size()); |
// Update the clip rects that will be passed to child layers. |
- if (renderer()->hasClipOrOverflowClip()) { |
+ if (renderer()->hasOverflowClip()) { |
// This layer establishes a clip of some kind. |
- if (renderer()->hasOverflowClip() && (this != clipRectsContext.rootLayer || clipRectsContext.respectOverflowClip == RespectOverflowClip)) { |
+ if (this != clipRectsContext.rootLayer || clipRectsContext.respectOverflowClip == RespectOverflowClip) { |
foregroundRect.intersect(toRenderBox(renderer())->overflowClipRect(offset, clipRectsContext.region, clipRectsContext.overlayScrollbarSizeRelevancy)); |
if (renderer()->style()->hasBorderRadius()) |
foregroundRect.setHasRadius(true); |
} |
- if (renderer()->hasClip()) { |
- // Clip applies to *us* as well, so go ahead and update the damageRect. |
- LayoutRect newPosClip = toRenderBox(renderer())->clipRect(offset, clipRectsContext.region); |
- backgroundRect.intersect(newPosClip); |
- foregroundRect.intersect(newPosClip); |
- outlineRect.intersect(newPosClip); |
- } |
- |
- // If we establish a clip at all, then go ahead and make sure our background |
+ // If we establish an overflow clip at all, then go ahead and make sure our background |
// rect is intersected with our layer's bounds including our visual overflow, |
// since any visual overflow like box-shadow or border-outset is not clipped by overflow:auto/hidden. |
if (renderBox()->hasVisualOverflow()) { |
+ // FIXME: Perhaps we should be propagating the borderbox as the clip rect for children, even though |
+ // we may need to inflate our clip specifically for shadows or outsets. |
// FIXME: Does not do the right thing with CSS regions yet, since we don't yet factor in the |
// individual region boxes as overflow. |
LayoutRect layerBoundsWithVisualOverflow = renderBox()->visualOverflowRect(); |
@@ -5027,7 +5021,7 @@ void RenderLayer::calculateRects(const ClipRectsContext& clipRectsContext, const |
layerBoundsWithVisualOverflow.moveBy(offset); |
if (this != clipRectsContext.rootLayer || clipRectsContext.respectOverflowClip == RespectOverflowClip) |
backgroundRect.intersect(layerBoundsWithVisualOverflow); |
- } else if (renderer()->hasOverflowClip()) { |
+ } else { |
// Shift the bounds to be for our region only. |
LayoutRect bounds = renderBox()->borderBoxRectInRegion(clipRectsContext.region); |
bounds.moveBy(offset); |
@@ -5035,6 +5029,15 @@ void RenderLayer::calculateRects(const ClipRectsContext& clipRectsContext, const |
backgroundRect.intersect(bounds); |
} |
} |
+ |
+ // CSS clip (different than clipping due to overflow) can clip to any box, even if it falls outside of the border box. |
+ if (renderer()->hasClip()) { |
+ // Clip applies to *us* as well, so go ahead and update the damageRect. |
+ LayoutRect newPosClip = toRenderBox(renderer())->clipRect(offset, clipRectsContext.region); |
+ backgroundRect.intersect(newPosClip); |
+ foregroundRect.intersect(newPosClip); |
+ outlineRect.intersect(newPosClip); |
+ } |
} |
LayoutRect RenderLayer::childrenClipRect() const |