Chromium Code Reviews| Index: Source/core/rendering/RenderLayerScrollableArea.cpp |
| diff --git a/Source/core/rendering/RenderLayerScrollableArea.cpp b/Source/core/rendering/RenderLayerScrollableArea.cpp |
| index d61144d26f7814ff6db932f4099e431361ea5cfc..981d1586f6857d2d4596dbb029b15d99adb1b394 100644 |
| --- a/Source/core/rendering/RenderLayerScrollableArea.cpp |
| +++ b/Source/core/rendering/RenderLayerScrollableArea.cpp |
| @@ -87,6 +87,8 @@ RenderLayerScrollableArea::RenderLayerScrollableArea(RenderLayer& layer) |
| , m_nextTopmostScrollChild(0) |
| , m_topmostScrollChild(0) |
| , m_needsCompositedScrolling(false) |
| + , m_horizontalScrollbarRectChanged(false) |
| + , m_verticalScrollbarRectChanged(false) |
| , m_scrollCorner(nullptr) |
| , m_resizer(nullptr) |
| { |
| @@ -619,10 +621,10 @@ void RenderLayerScrollableArea::updateAfterLayout() |
| setHasVerticalScrollbar(false); |
| } |
| // overflow:auto may need to lay out again if scrollbars got added/removed. |
| - bool autoHorizontalScrollBarChanged = box().hasAutoHorizontalScrollbar() && (hasHorizontalScrollbar() != hasHorizontalOverflow); |
| - bool autoVerticalScrollBarChanged = box().hasAutoVerticalScrollbar() && (hasVerticalScrollbar() != hasVerticalOverflow); |
| + bool horizontalScrollBarChanged = (box().hasAutoHorizontalScrollbar() && (hasHorizontalScrollbar() != hasHorizontalOverflow)) || m_horizontalScrollbarRectChanged; |
| + bool verticalScrollBarChanged = (box().hasAutoVerticalScrollbar() && (hasVerticalScrollbar() != hasVerticalOverflow)) || m_verticalScrollbarRectChanged; |
| - if (autoHorizontalScrollBarChanged || autoVerticalScrollBarChanged) { |
| + if (horizontalScrollBarChanged || verticalScrollBarChanged) { |
| if (box().hasAutoHorizontalScrollbar()) |
| setHasHorizontalScrollbar(hasHorizontalOverflow); |
| if (box().hasAutoVerticalScrollbar()) |
| @@ -637,7 +639,7 @@ void RenderLayerScrollableArea::updateAfterLayout() |
| if (box().document().hasAnnotatedRegions()) |
| box().document().setAnnotatedRegionsDirty(true); |
| - if (box().style()->overflowX() == OAUTO || box().style()->overflowY() == OAUTO) { |
| + if (box().style()->overflowX() == OAUTO || box().style()->overflowY() == OAUTO || m_verticalScrollbarRectChanged || m_horizontalScrollbarRectChanged) { |
|
skobes
2014/11/10 20:26:09
I think this codepath is intended for the case whe
|
| if (!m_inOverflowRelayout) { |
| // Our proprietary overflow: overlay value doesn't trigger a layout. |
| m_inOverflowRelayout = true; |
| @@ -645,13 +647,15 @@ void RenderLayerScrollableArea::updateAfterLayout() |
| layoutScope.setNeedsLayout(&box()); |
| if (box().isRenderBlock()) { |
| RenderBlock& block = toRenderBlock(box()); |
| - block.scrollbarsChanged(autoHorizontalScrollBarChanged, autoVerticalScrollBarChanged); |
| + block.scrollbarsChanged(horizontalScrollBarChanged, verticalScrollBarChanged); |
| block.layoutBlock(true); |
| } else { |
| box().layout(); |
| } |
| m_inOverflowRelayout = false; |
| } |
| + m_verticalScrollbarRectChanged = false; |
| + m_horizontalScrollbarRectChanged = false; |
| } |
| } |
| @@ -753,10 +757,18 @@ void RenderLayerScrollableArea::updateAfterStyleChange(const RenderStyle* oldSty |
| } |
| // FIXME: Need to detect a swap from custom to native scrollbars (and vice versa). |
| - if (m_hBar) |
| + if (m_hBar) { |
| + IntRect oldHBarRect = m_hBar->frameRect(); |
| m_hBar->styleChanged(); |
| - if (m_vBar) |
| + if (oldHBarRect != m_hBar->frameRect()) |
| + m_horizontalScrollbarRectChanged = true; |
| + } |
| + if (m_vBar) { |
| + IntRect oldVBarRect = m_vBar->frameRect(); |
| m_vBar->styleChanged(); |
| + if (oldVBarRect != m_vBar->frameRect()) |
| + m_verticalScrollbarRectChanged = true; |
| + } |
|
MuVen
2014/11/11 14:45:04
if (box().isRenderBlock()) {
RenderBlock&
|
| updateScrollCornerStyle(); |
| updateResizerAreaSet(); |