Index: third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp |
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp b/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp |
index 1a7b0d47a54ab09c57564cb94854127dc27d0ffb..7bad7c304f7576fa9303c8fcc913419acb64b943 100644 |
--- a/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp |
+++ b/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp |
@@ -314,11 +314,29 @@ void PaintLayerClipper::calculateRects( |
LayoutRect& layerBounds, |
ClipRect& backgroundRect, |
ClipRect& foregroundRect, |
- const LayoutPoint* offsetFromRoot) const { |
+ const LayoutPoint* offsetFromRoot, |
+ const bool addAncestorClips) const { |
if (m_geometryMapper) { |
calculateRectsWithGeometryMapper(context, paintDirtyRect, layerBounds, |
backgroundRect, foregroundRect, |
offsetFromRoot); |
+ |
+ // CSS clip (different than clipping due to overflow) can clip to any box, |
+ // even if it falls outside of the border box. |
Stephen Chennney
2016/11/08 21:42:52
Wrong base? I'm not sure I changed this.
|
+ LayoutBoxModelObject& layoutObject = *m_layer.layoutObject(); |
+ LayoutPoint offset; |
+ if (offsetFromRoot) |
+ offset = *offsetFromRoot; |
+ else |
+ m_layer.convertToLayerCoords(context.rootLayer, offset); |
+ if (layoutObject.hasClip()) { |
+ // Clip applies to *us* as well, so go ahead and update the damageRect. |
+ LayoutRect newPosClip = toLayoutBox(layoutObject).clipRect(offset); |
+ backgroundRect.intersect(newPosClip); |
+ backgroundRect.setIsClippedByClipCss(); |
+ foregroundRect.intersect(newPosClip); |
+ foregroundRect.setIsClippedByClipCss(); |
+ } |
return; |
} |
@@ -343,11 +361,12 @@ void PaintLayerClipper::calculateRects( |
layerBounds = LayoutRect(offset, LayoutSize(m_layer.size())); |
// Update the clip rects that will be passed to child layers. |
- if (shouldClipOverflow(context)) { |
+ if (addAncestorClips || shouldClipOverflow(context)) { |
Stephen Chennney
2016/11/08 21:42:52
Trying to get rid of this by having the layoutObje
|
+ if (addAncestorClips) fprintf(stderr, "Preparing due to addAncestorClips\n"); |
foregroundRect.intersect( |
toLayoutBox(layoutObject) |
.overflowClipRect(offset, context.overlayScrollbarClipBehavior)); |
- if (layoutObject.styleRef().hasBorderRadius()) |
+ if (layoutObject.styleRef().hasBorderRadius() || addAncestorClips) |
foregroundRect.setHasRadius(true); |
// FIXME: Does not do the right thing with columns yet, since we don't yet |