| Index: Source/core/rendering/RenderBox.cpp
|
| diff --git a/Source/core/rendering/RenderBox.cpp b/Source/core/rendering/RenderBox.cpp
|
| index 30f81ffee71d501e462244399530fa09f8f2c6bd..311729dc019d3ba0e9f3961e1a9d9e21bdede199 100644
|
| --- a/Source/core/rendering/RenderBox.cpp
|
| +++ b/Source/core/rendering/RenderBox.cpp
|
| @@ -1517,7 +1517,7 @@ bool RenderBox::repaintLayerRectsForImage(WrappedImagePtr image, const FillLayer
|
| return false;
|
| }
|
|
|
| -bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumulatedOffset)
|
| +bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumulatedOffset, ContentsClipBehavior contentsClipBehavior)
|
| {
|
| if (paintInfo.phase == PaintPhaseBlockBackground || paintInfo.phase == PaintPhaseSelfOutline || paintInfo.phase == PaintPhaseMask)
|
| return false;
|
| @@ -1528,6 +1528,27 @@ bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumu
|
| if (!isControlClip && !isOverflowClip)
|
| return false;
|
|
|
| + LayoutRect clipRect = isControlClip ? controlClipRect(accumulatedOffset) : overflowClipRect(accumulatedOffset, paintInfo.renderRegion);
|
| + RoundedRect clipRoundedRect(0, 0, 0, 0);
|
| + bool hasBorderRadius = style()->hasBorderRadius();
|
| + if (hasBorderRadius)
|
| + clipRoundedRect = style()->getRoundedInnerBorderFor(LayoutRect(accumulatedOffset, size()));
|
| +
|
| + if (contentsClipBehavior == SkipContentsClipIfPossible) {
|
| + LayoutRect contentsVisualOverflow = contentsVisualOverflowRect();
|
| + if (contentsVisualOverflow.isEmpty())
|
| + return false;
|
| +
|
| + LayoutRect conservativeClipRect = clipRect;
|
| + if (hasBorderRadius)
|
| + conservativeClipRect.intersect(clipRoundedRect.radiusCenterRect());
|
| + conservativeClipRect.moveBy(-accumulatedOffset);
|
| + if (hasLayer())
|
| + conservativeClipRect.move(scrolledContentOffset());
|
| + if (conservativeClipRect.contains(contentsVisualOverflow))
|
| + return false;
|
| + }
|
| +
|
| if (paintInfo.phase == PaintPhaseOutline)
|
| paintInfo.phase = PaintPhaseChildOutlines;
|
| else if (paintInfo.phase == PaintPhaseChildBlockBackground) {
|
| @@ -1535,11 +1556,10 @@ bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumu
|
| paintObject(paintInfo, accumulatedOffset);
|
| paintInfo.phase = PaintPhaseChildBlockBackgrounds;
|
| }
|
| - IntRect clipRect = pixelSnappedIntRect(isControlClip ? controlClipRect(accumulatedOffset) : overflowClipRect(accumulatedOffset, paintInfo.renderRegion));
|
| paintInfo.context->save();
|
| - if (style()->hasBorderRadius())
|
| - paintInfo.context->clipRoundedRect(style()->getRoundedInnerBorderFor(LayoutRect(accumulatedOffset, size())));
|
| - paintInfo.context->clip(clipRect);
|
| + if (hasBorderRadius)
|
| + paintInfo.context->clipRoundedRect(clipRoundedRect);
|
| + paintInfo.context->clip(pixelSnappedIntRect(clipRect));
|
| return true;
|
| }
|
|
|
| @@ -4210,7 +4230,8 @@ void RenderBox::addVisualEffectOverflow()
|
| }
|
|
|
| // Add in the final overflow with shadows and outsets combined.
|
| - addVisualOverflow(LayoutRect(overflowMinX, overflowMinY, overflowMaxX - overflowMinX, overflowMaxY - overflowMinY));
|
| + LayoutRect visualEffectOverflow(overflowMinX, overflowMinY, overflowMaxX - overflowMinX, overflowMaxY - overflowMinY);
|
| + addVisualOverflow(visualEffectOverflow);
|
| }
|
|
|
| void RenderBox::addOverflowFromChild(RenderBox* child, const LayoutSize& delta)
|
| @@ -4229,11 +4250,11 @@ void RenderBox::addOverflowFromChild(RenderBox* child, const LayoutSize& delta)
|
| // Add in visual overflow from the child. Even if the child clips its overflow, it may still
|
| // have visual overflow of its own set from box shadows or reflections. It is unnecessary to propagate this
|
| // overflow if we are clipping our own overflow.
|
| - if (child->hasSelfPaintingLayer() || hasOverflowClip())
|
| + if (child->hasSelfPaintingLayer())
|
| return;
|
| LayoutRect childVisualOverflowRect = child->visualOverflowRectForPropagation(style());
|
| childVisualOverflowRect.move(delta);
|
| - addVisualOverflow(childVisualOverflowRect);
|
| + addContentsVisualOverflow(childVisualOverflowRect);
|
| }
|
|
|
| void RenderBox::addLayoutOverflow(const LayoutRect& rect)
|
| @@ -4298,12 +4319,24 @@ void RenderBox::addVisualOverflow(const LayoutRect& rect)
|
| m_overflow->addVisualOverflow(rect);
|
| }
|
|
|
| +void RenderBox::addContentsVisualOverflow(const LayoutRect& rect)
|
| +{
|
| + if (!hasOverflowClip()) {
|
| + addVisualOverflow(rect);
|
| + return;
|
| + }
|
| +
|
| + if (!m_overflow)
|
| + m_overflow = adoptPtr(new RenderOverflow(clientBoxRect(), borderBoxRect()));
|
| + m_overflow->addContentsVisualOverflow(rect);
|
| +}
|
| +
|
| void RenderBox::clearLayoutOverflow()
|
| {
|
| if (!m_overflow)
|
| return;
|
|
|
| - if (!hasVisualOverflow()) {
|
| + if (!hasVisualOverflow() && contentsVisualOverflowRect().isEmpty()) {
|
| m_overflow.clear();
|
| return;
|
| }
|
|
|