Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1720)

Unified Diff: Source/core/rendering/RenderLayer.cpp

Issue 17894005: Merge 152980 "CSS clip should not be considered when clamping fo..." (Closed) Base URL: svn://svn.chromium.org/blink/branches/chromium/1547/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/compositing/geometry/clip-with-shadow-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderLayer.cpp
===================================================================
--- Source/core/rendering/RenderLayer.cpp (revision 153083)
+++ Source/core/rendering/RenderLayer.cpp (working copy)
@@ -5002,26 +5002,20 @@
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();
@@ -5029,7 +5023,7 @@
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);
@@ -5037,6 +5031,15 @@
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
« no previous file with comments | « LayoutTests/compositing/geometry/clip-with-shadow-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698