Chromium Code Reviews| 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 71347c9ed0c82e8c6d1e1a8cb69c0e963733c402..945f6145d9001df3e957db0c4fd0f54fc21555cf 100644 |
| --- a/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp |
| +++ b/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp |
| @@ -319,6 +319,23 @@ void PaintLayerClipper::calculateRects( |
| calculateRectsWithGeometryMapper(context, paintDirtyRect, layerBounds, |
| backgroundRect, foregroundRect, |
| offsetFromRoot); |
| + |
| + // CSS clip (different than clipping due to overflow) can clip to any box, |
|
chrishtr
2016/11/16 23:56:32
The code you are inserting here is SPv2-specific.
Stephen Chennney
2016/11/17 18:05:48
I shouldn't be; I think I was being over-zealous.
|
| + // even if it falls outside of the border box. |
| + 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; |
| } |
| @@ -344,9 +361,10 @@ void PaintLayerClipper::calculateRects( |
| // Update the clip rects that will be passed to child layers. |
| if (shouldClipOverflow(context)) { |
| - foregroundRect.intersect( |
| + LayoutRect offsetOverflowClipRect = |
| toLayoutBox(layoutObject) |
| - .overflowClipRect(offset, context.overlayScrollbarClipBehavior)); |
| + .overflowClipRect(offset, context.overlayScrollbarClipBehavior); |
| + foregroundRect.intersect(offsetOverflowClipRect); |
| if (layoutObject.styleRef().hasBorderRadius()) |
| foregroundRect.setHasRadius(true); |