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 e849a756ff2755ae271d2248bb976e86d9da8892..3a813ef149e73febad9b91f51fead479b1c9f21b 100644 |
--- a/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp |
+++ b/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp |
@@ -344,9 +344,7 @@ void PaintLayerClipper::calculateRects( |
layerBounds = LayoutRect(offset, LayoutSize(m_layer.size())); |
// Update the clip rects that will be passed to child layers. |
- if ((layoutObject.hasOverflowClip() || |
- layoutObject.styleRef().containsPaint()) && |
- shouldRespectOverflowClip(context)) { |
+ if (shouldClipOverflow(context)) { |
foregroundRect.intersect( |
toLayoutBox(layoutObject) |
.overflowClipRect(offset, context.overlayScrollbarClipBehavior)); |
@@ -407,10 +405,9 @@ void PaintLayerClipper::calculateClipRects(const ClipRectsContext& context, |
adjustClipRectsForChildren(layoutObject, clipRects); |
- if ((layoutObject.hasOverflowClip() && shouldRespectOverflowClip(context)) || |
+ if (shouldClipOverflow(context) || layoutObject.hasClip() || |
(layoutObject.isSVGRoot() && |
- toLayoutSVGRoot(&layoutObject)->shouldApplyViewportClip()) || |
- layoutObject.hasClip() || layoutObject.styleRef().containsPaint()) { |
+ toLayoutSVGRoot(&layoutObject)->shouldApplyViewportClip())) { |
// This offset cannot use convertToLayerCoords, because sometimes our |
// rootLayer may be across some transformed layer boundary, for example, in |
// the PaintLayerCompositor overlapMap, where clipRects are needed in view |
@@ -447,13 +444,8 @@ ClipRect PaintLayerClipper::clipRectWithGeometryMapper( |
if (properties->cssClip()) |
propertyTreeState.setClip(properties->cssClip()); |
- const LayoutObject& layoutObject = *m_layer.layoutObject(); |
- if (shouldRespectOverflowClip(context) && isForeground && |
- (layoutObject.hasOverflowClip() || |
- layoutObject.styleRef().containsPaint())) { |
- if (properties->overflowClip()) |
- propertyTreeState.setClip(properties->overflowClip()); |
- } |
+ if (isForeground && shouldClipOverflow(context) && properties->overflowClip()) |
+ propertyTreeState.setClip(properties->overflowClip()); |
const ObjectPaintProperties* ancestorProperties = |
context.rootLayer->layoutObject()->objectPaintProperties(); |
@@ -476,9 +468,7 @@ ClipRect PaintLayerClipper::applyOverflowClipToBackgroundRectWithGeometryMapper( |
const ClipRect& clip) const { |
const LayoutObject& layoutObject = *m_layer.layoutObject(); |
FloatRect clipRect(clip.rect()); |
- if ((layoutObject.hasOverflowClip() || |
- layoutObject.styleRef().containsPaint()) && |
- shouldRespectOverflowClip(context)) { |
+ if (shouldClipOverflow(context)) { |
LayoutRect layerBoundsWithVisualOverflow = |
layoutObject.isLayoutView() |
? toLayoutView(layoutObject).viewRect() |
@@ -538,6 +528,13 @@ void PaintLayerClipper::getOrCalculateClipRects(const ClipRectsContext& context, |
calculateClipRects(context, clipRects); |
} |
+bool PaintLayerClipper::shouldClipOverflow( |
+ const ClipRectsContext& context) const { |
+ return (m_layer.layoutObject()->hasOverflowClip() || |
+ m_layer.layoutObject()->styleRef().containsPaint()) && |
+ shouldRespectOverflowClip(context); |
+} |
+ |
bool PaintLayerClipper::shouldRespectOverflowClip( |
const ClipRectsContext& context) const { |
if (&m_layer != context.rootLayer) |