Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1258)

Unified Diff: Source/core/paint/DeprecatedPaintLayerScrollableArea.cpp

Issue 1295933003: Add overflow:auto scrollbars to child flex basis. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add entries to SlowTests Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/paint/DeprecatedPaintLayerScrollableArea.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/DeprecatedPaintLayerScrollableArea.cpp
diff --git a/Source/core/paint/DeprecatedPaintLayerScrollableArea.cpp b/Source/core/paint/DeprecatedPaintLayerScrollableArea.cpp
index 2bfbb871ad730bfe8fd927c5349c3393d086f9a6..d60881bca20e76efa59897efde23d827a611e561 100644
--- a/Source/core/paint/DeprecatedPaintLayerScrollableArea.cpp
+++ b/Source/core/paint/DeprecatedPaintLayerScrollableArea.cpp
@@ -650,7 +650,7 @@ void DeprecatedPaintLayerScrollableArea::scrollToOffset(const DoubleSize& scroll
}
}
-void DeprecatedPaintLayerScrollableArea::updateAfterLayout()
+void DeprecatedPaintLayerScrollableArea::updateScrollDimensions(DoubleSize& scrollOffset, bool& autoHorizontalScrollBarChanged, bool& autoVerticalScrollBarChanged)
{
ASSERT(box().hasOverflowClip());
@@ -661,8 +661,31 @@ void DeprecatedPaintLayerScrollableArea::updateAfterLayout()
destroyScrollbar(VerticalScrollbar);
}
- DoubleSize originalScrollOffset = adjustedScrollOffset();
+ scrollOffset = adjustedScrollOffset();
computeScrollDimensions();
+ bool hasHorizontalOverflow = this->hasHorizontalOverflow();
+ bool hasVerticalOverflow = this->hasVerticalOverflow();
+ if (hasOverlayScrollbars()) {
+ if (!scrollSize(HorizontalScrollbar))
+ setHasHorizontalScrollbar(false);
+ if (!scrollSize(VerticalScrollbar))
+ setHasVerticalScrollbar(false);
+ }
+
+ // overflow:auto may need to lay out again if scrollbars got added/removed.
+ autoHorizontalScrollBarChanged = (box().hasAutoHorizontalScrollbar() && (hasHorizontalScrollbar() != hasHorizontalOverflow)) || (box().style()->overflowX() == OSCROLL && !horizontalScrollbar());
+ autoVerticalScrollBarChanged = (box().hasAutoVerticalScrollbar() && (hasVerticalScrollbar() != hasVerticalOverflow)) || (box().style()->overflowY() == OSCROLL && !verticalScrollbar());
+ if (!visualViewportSuppliesScrollbars() && (autoHorizontalScrollBarChanged || autoVerticalScrollBarChanged)) {
+ if (box().hasAutoHorizontalScrollbar() || (box().style()->overflowX() == OSCROLL && !horizontalScrollbar()))
+ setHasHorizontalScrollbar(box().style()->overflowX() == OSCROLL ? true : hasHorizontalOverflow);
+ if (box().hasAutoVerticalScrollbar() || (box().style()->overflowY() == OSCROLL && !verticalScrollbar()))
+ setHasVerticalScrollbar(box().style()->overflowY() == OSCROLL ? true : hasVerticalOverflow);
+ }
+}
+
+void DeprecatedPaintLayerScrollableArea::finalizeScrollDimensions(const DoubleSize& originalScrollOffset, bool autoHorizontalScrollBarChanged, bool autoVerticalScrollBarChanged)
+{
+ ASSERT(box().hasOverflowClip());
// Layout may cause us to be at an invalid scroll position. In this case we need
// to pull our scroll offsets back to the max (or push them up to the min).
@@ -689,18 +712,7 @@ void DeprecatedPaintLayerScrollableArea::updateAfterLayout()
verticalScrollbar()->setEnabled(hasVerticalOverflow);
}
- // 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))
- || (box().style()->overflowX() == OSCROLL && !horizontalScrollbar());
- bool verticalScrollBarChanged = (box().hasAutoVerticalScrollbar() && (hasVerticalScrollbar() != hasVerticalOverflow))
- || (box().style()->overflowY() == OSCROLL && !verticalScrollbar());
- if (!visualViewportSuppliesScrollbars() && (horizontalScrollBarChanged || verticalScrollBarChanged)) {
- if (box().hasAutoHorizontalScrollbar() || (box().style()->overflowX() == OSCROLL && !horizontalScrollbar()))
- setHasHorizontalScrollbar(box().style()->overflowX() == OSCROLL ? true : hasHorizontalOverflow);
- if (box().hasAutoVerticalScrollbar() || (box().style()->overflowY() == OSCROLL && !verticalScrollbar()))
- setHasVerticalScrollbar(box().style()->overflowY() == OSCROLL ? true : hasVerticalOverflow);
-
+ if (!visualViewportSuppliesScrollbars() && (autoHorizontalScrollBarChanged || autoVerticalScrollBarChanged)) {
if (hasVerticalOverflow || hasHorizontalOverflow)
updateScrollCornerStyle();
@@ -711,14 +723,14 @@ void DeprecatedPaintLayerScrollableArea::updateAfterLayout()
box().document().setAnnotatedRegionsDirty(true);
// Our proprietary overflow: overlay value doesn't trigger a layout.
- if ((horizontalScrollBarChanged && box().style()->overflowX() != OOVERLAY) || (verticalScrollBarChanged && box().style()->overflowY() != OOVERLAY)) {
+ if ((autoHorizontalScrollBarChanged && box().style()->overflowX() != OOVERLAY) || (autoVerticalScrollBarChanged && box().style()->overflowY() != OOVERLAY)) {
if (!m_inOverflowRelayout) {
m_inOverflowRelayout = true;
SubtreeLayoutScope layoutScope(box());
layoutScope.setNeedsLayout(&box(), LayoutInvalidationReason::ScrollbarChanged);
if (box().isLayoutBlock()) {
LayoutBlock& block = toLayoutBlock(box());
- block.scrollbarsChanged(horizontalScrollBarChanged, verticalScrollBarChanged);
+ block.scrollbarsChanged(autoHorizontalScrollBarChanged, autoVerticalScrollBarChanged);
block.layoutBlock(true);
} else {
box().layout();
@@ -757,6 +769,15 @@ void DeprecatedPaintLayerScrollableArea::updateAfterLayout()
positionOverflowControls();
}
+void DeprecatedPaintLayerScrollableArea::updateAfterLayout()
+{
+ DoubleSize originalScrollOffset;
+ bool autoHorizontalScrollBarChanged;
+ bool autoVerticalScrollBarChanged;
+ updateScrollDimensions(originalScrollOffset, autoHorizontalScrollBarChanged, autoVerticalScrollBarChanged);
+ finalizeScrollDimensions(originalScrollOffset, autoHorizontalScrollBarChanged, autoVerticalScrollBarChanged);
+}
+
ScrollBehavior DeprecatedPaintLayerScrollableArea::scrollBehaviorStyle() const
{
return box().style()->scrollBehavior();
« no previous file with comments | « Source/core/paint/DeprecatedPaintLayerScrollableArea.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698