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

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp

Issue 2116873002: Get rid of spurious horizontal scrollbars on column flexboxes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 4 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 bf67c5a40a6e0d90e096ce7bb999f14a1681686c..209a6cab8287a643583afcd4d6f631e5993a596c 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
@@ -775,7 +775,18 @@ ScrollBehavior PaintLayerScrollableArea::scrollBehaviorStyle() const
bool PaintLayerScrollableArea::hasHorizontalOverflow() const
{
- return pixelSnappedScrollWidth() > box().pixelSnappedClientWidth();
+ // TODO(szager): Make the algorithm for adding/subtracting overflow:auto
+ // scrollbars memoryless (crbug.com/625300). This clientWidth hack will
+ // prevent the spurious horizontal scrollbar, but it can cause a converse
+ // problem: it can leave a sliver of horizontal overflow hidden behind the
+ // vertical scrollbar without creating a horizontal scrollbar. This
+ // converse problem seems to happen much less frequently in practice, so we
+ // bias the logic towards preventing unwanted horizontal scrollbars, which
+ // are more common and annoying.
+ int clientWidth = box().pixelSnappedClientWidth();
+ if (needsRelayout() && !hadVerticalScrollbarBeforeRelayout())
+ clientWidth += verticalScrollbarWidth();
+ return pixelSnappedScrollWidth() > clientWidth;
}
bool PaintLayerScrollableArea::hasVerticalOverflow() const
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698