Index: third_party/WebKit/Source/core/paint/BoxClipper.cpp |
diff --git a/third_party/WebKit/Source/core/paint/BoxClipper.cpp b/third_party/WebKit/Source/core/paint/BoxClipper.cpp |
index 6355078338ba7f8605031ba53decf96cabb74ae5..19c86d7ea712dbe9bbe0e6a7330205a0b987f8d0 100644 |
--- a/third_party/WebKit/Source/core/paint/BoxClipper.cpp |
+++ b/third_party/WebKit/Source/core/paint/BoxClipper.cpp |
@@ -20,19 +20,34 @@ BoxClipper::BoxClipper(const LayoutBox& box, const PaintInfo& paintInfo, const L |
, m_paintInfo(paintInfo) |
, m_clipType(DisplayItem::UninitializedType) |
{ |
- if (m_paintInfo.phase == PaintPhaseBlockBackground || m_paintInfo.phase == PaintPhaseSelfOutline || m_paintInfo.phase == PaintPhaseMask) |
+ if ((m_paintInfo.phase == PaintPhaseBlockBackground && contentsClipBehavior != ClipForScrollbars) |
+ || m_paintInfo.phase == PaintPhaseSelfOutline || m_paintInfo.phase == PaintPhaseMask) |
return; |
- bool isControlClip = m_box.hasControlClip(); |
- bool isOverflowClip = m_box.hasOverflowClip() && !m_box.layer()->isSelfPaintingLayer(); |
+ bool hasControlClip = m_box.hasControlClip(); |
+ bool hasOverflowClip = m_box.hasOverflowClip() && !m_box.layer()->isSelfPaintingLayer(); |
- if (!isControlClip && !isOverflowClip) |
+ if (!hasControlClip && !hasOverflowClip) |
return; |
- LayoutRect clipRect = isControlClip ? m_box.controlClipRect(accumulatedOffset) : m_box.overflowClipRect(accumulatedOffset); |
+ LayoutRect clipRect; |
+ |
+ if (hasControlClip) { |
+ clipRect = m_box.controlClipRect(accumulatedOffset); |
+ } else { |
+ ASSERT(hasOverflowClip); |
+ if (contentsClipBehavior == ClipForScrollbars) { |
+ clipRect = m_box.borderBoxRect(); |
+ clipRect.moveBy(accumulatedOffset); |
+ } else { |
+ clipRect = m_box.overflowClipRect(accumulatedOffset); |
+ } |
+ } |
+ |
FloatRoundedRect clipRoundedRect(0, 0, 0, 0); |
- bool hasBorderRadius = m_box.style()->hasBorderRadius(); |
- if (hasBorderRadius) |
+ // Scrollbars paint on top of a rounded border. |
+ bool shouldClipBorderRadius = m_box.style()->hasBorderRadius() && contentsClipBehavior != ClipForScrollbars; |
+ if (shouldClipBorderRadius) |
clipRoundedRect = m_box.style()->getRoundedInnerBorderFor(LayoutRect(accumulatedOffset, m_box.size())); |
if (contentsClipBehavior == SkipContentsClipIfPossible) { |
@@ -41,7 +56,7 @@ BoxClipper::BoxClipper(const LayoutBox& box, const PaintInfo& paintInfo, const L |
return; |
LayoutRect conservativeClipRect = clipRect; |
- if (hasBorderRadius) |
+ if (shouldClipBorderRadius) |
conservativeClipRect.intersect(LayoutRect(clipRoundedRect.radiusCenterRect())); |
conservativeClipRect.moveBy(-accumulatedOffset); |
if (m_box.hasLayer()) |
@@ -53,7 +68,7 @@ BoxClipper::BoxClipper(const LayoutBox& box, const PaintInfo& paintInfo, const L |
if (!m_paintInfo.context->paintController().displayItemConstructionIsDisabled()) { |
m_clipType = m_paintInfo.displayItemTypeForClipping(); |
Vector<FloatRoundedRect> roundedRects; |
- if (hasBorderRadius) |
+ if (shouldClipBorderRadius) |
roundedRects.append(clipRoundedRect); |
m_paintInfo.context->paintController().createAndAppend<ClipDisplayItem>(m_box, m_clipType, pixelSnappedIntRect(clipRect), roundedRects); |
} |