Index: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp |
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp |
index 059ae5c56cd837daaecba9df25ae72258ef1403d..2a1ed5c548fb45a4575efdba316d4b0b95b956ad 100644 |
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp |
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp |
@@ -639,6 +639,10 @@ bool PaintLayerScrollableArea::updateAfterLayout(SubtreeLayoutScope* delayedLayo |
bool hasHorizontalOverflow = this->hasHorizontalOverflow(); |
bool hasVerticalOverflow = this->hasVerticalOverflow(); |
+ // Don't add auto scrollbars if the box contents aren't visible. |
+ bool shouldHaveAutoHorizontalScrollbar = hasHorizontalOverflow && box().pixelSnappedClientHeight(); |
+ bool shouldHaveAutoVerticalScrollbar = hasVerticalOverflow && box().pixelSnappedClientWidth(); |
+ |
{ |
// Hits in compositing/overflow/automatically-opt-into-composited-scrolling-after-style-change.html. |
DisableCompositingQueryAsserts disabler; |
@@ -652,21 +656,21 @@ bool PaintLayerScrollableArea::updateAfterLayout(SubtreeLayoutScope* delayedLayo |
// We need to layout again if scrollbars are added or removed by overflow:auto, |
// or by changing between native and custom. |
- bool horizontalScrollBarChanged = (box().hasAutoHorizontalScrollbar() && (hasHorizontalScrollbar() != hasHorizontalOverflow)) |
+ bool horizontalScrollBarChanged = (box().hasAutoHorizontalScrollbar() && (hasHorizontalScrollbar() != shouldHaveAutoHorizontalScrollbar)) |
|| (box().style()->overflowX() == OverflowScroll && !horizontalScrollbar()); |
- bool verticalScrollBarChanged = (box().hasAutoVerticalScrollbar() && (hasVerticalScrollbar() != hasVerticalOverflow)) |
+ bool verticalScrollBarChanged = (box().hasAutoVerticalScrollbar() && (hasVerticalScrollbar() != shouldHaveAutoVerticalScrollbar)) |
|| (box().style()->overflowY() == OverflowScroll && !verticalScrollbar()); |
if (!visualViewportSuppliesScrollbars() && (horizontalScrollBarChanged || verticalScrollBarChanged)) { |
if (box().hasAutoHorizontalScrollbar()) |
- setHasHorizontalScrollbar(hasHorizontalOverflow); |
+ setHasHorizontalScrollbar(shouldHaveAutoHorizontalScrollbar); |
else if (box().style()->overflowX() == OverflowScroll) |
setHasHorizontalScrollbar(true); |
if (box().hasAutoVerticalScrollbar()) |
- setHasVerticalScrollbar(hasVerticalOverflow); |
+ setHasVerticalScrollbar(shouldHaveAutoVerticalScrollbar); |
else if (box().style()->overflowY() == OverflowScroll) |
setHasVerticalScrollbar(true); |
- if (hasVerticalOverflow || hasHorizontalOverflow) |
+ if (hasScrollbar()) |
updateScrollCornerStyle(); |
layer()->updateSelfPaintingLayer(); |
@@ -678,6 +682,11 @@ bool PaintLayerScrollableArea::updateAfterLayout(SubtreeLayoutScope* delayedLayo |
// Our proprietary overflow: overlay value doesn't trigger a layout. |
if ((horizontalScrollBarChanged && box().style()->overflowX() != OverflowOverlay) || (verticalScrollBarChanged && box().style()->overflowY() != OverflowOverlay)) { |
if (!m_inOverflowRelayout) { |
+ if ((verticalScrollBarChanged && box().isHorizontalWritingMode()) |
+ || (horizontalScrollBarChanged && !box().isHorizontalWritingMode())) { |
+ box().setPreferredLogicalWidthsDirty(); |
+ box().updateLogicalWidth(); |
skobes
2016/05/16 20:55:53
Won't this (updateLogicalWidth) happen during layo
szager1
2016/05/23 22:17:31
If delayedLayoutScope is not null, then layout won
|
+ } |
m_inOverflowRelayout = true; |
if (delayedLayoutScope) { |
if (box().isLayoutBlock()) |