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

Side by Side 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, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@gmail.com> 9 * Christian Biesinger <cbiesinger@gmail.com>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 m_scrollbarManager.destroyDetachedScrollbars(); 768 m_scrollbarManager.destroyDetachedScrollbars();
769 } 769 }
770 770
771 ScrollBehavior PaintLayerScrollableArea::scrollBehaviorStyle() const 771 ScrollBehavior PaintLayerScrollableArea::scrollBehaviorStyle() const
772 { 772 {
773 return box().style()->getScrollBehavior(); 773 return box().style()->getScrollBehavior();
774 } 774 }
775 775
776 bool PaintLayerScrollableArea::hasHorizontalOverflow() const 776 bool PaintLayerScrollableArea::hasHorizontalOverflow() const
777 { 777 {
778 return pixelSnappedScrollWidth() > box().pixelSnappedClientWidth(); 778 // TODO(szager): Make the algorithm for adding/subtracting overflow:auto
779 // scrollbars memoryless (crbug.com/625300). This clientWidth hack will
780 // prevent the spurious horizontal scrollbar, but it can cause a converse
781 // problem: it can leave a sliver of horizontal overflow hidden behind the
782 // vertical scrollbar without creating a horizontal scrollbar. This
783 // converse problem seems to happen much less frequently in practice, so we
784 // bias the logic towards preventing unwanted horizontal scrollbars, which
785 // are more common and annoying.
786 int clientWidth = box().pixelSnappedClientWidth();
787 if (needsRelayout() && !hadVerticalScrollbarBeforeRelayout())
788 clientWidth += verticalScrollbarWidth();
789 return pixelSnappedScrollWidth() > clientWidth;
779 } 790 }
780 791
781 bool PaintLayerScrollableArea::hasVerticalOverflow() const 792 bool PaintLayerScrollableArea::hasVerticalOverflow() const
782 { 793 {
783 return pixelSnappedScrollHeight() > box().pixelSnappedClientHeight(); 794 return pixelSnappedScrollHeight() > box().pixelSnappedClientHeight();
784 } 795 }
785 796
786 bool PaintLayerScrollableArea::hasScrollableHorizontalOverflow() const 797 bool PaintLayerScrollableArea::hasScrollableHorizontalOverflow() const
787 { 798 {
788 return hasHorizontalOverflow() && box().scrollsOverflowX(); 799 return hasHorizontalOverflow() && box().scrollsOverflowX();
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after
1742 1753
1743 void PaintLayerScrollableArea::DelayScrollPositionClampScope::clampScrollableAre as() 1754 void PaintLayerScrollableArea::DelayScrollPositionClampScope::clampScrollableAre as()
1744 { 1755 {
1745 for (auto& scrollableArea : *s_needsClamp) 1756 for (auto& scrollableArea : *s_needsClamp)
1746 scrollableArea->clampScrollPositionsAfterLayout(); 1757 scrollableArea->clampScrollPositionsAfterLayout();
1747 delete s_needsClamp; 1758 delete s_needsClamp;
1748 s_needsClamp = nullptr; 1759 s_needsClamp = nullptr;
1749 } 1760 }
1750 1761
1751 } // namespace blink 1762 } // namespace blink
OLDNEW
« 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