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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp

Issue 2759213002: Add auto scrollbars if content would be visible without them. (Closed)
Patch Set: test Created 3 years, 9 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 | third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp » ('j') | 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 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
6 * 6 *
7 * Other contributors: 7 * Other contributors:
8 * Robert O'Callahan <roc+@cs.cmu.edu> 8 * Robert O'Callahan <roc+@cs.cmu.edu>
9 * David Baron <dbaron@fas.harvard.edu> 9 * David Baron <dbaron@fas.harvard.edu>
10 * Christian Biesinger <cbiesinger@gmail.com> 10 * Christian Biesinger <cbiesinger@gmail.com>
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 return; 1201 return;
1202 } 1202 }
1203 1203
1204 needsHorizontalScrollbar = box().scrollsOverflowX(); 1204 needsHorizontalScrollbar = box().scrollsOverflowX();
1205 needsVerticalScrollbar = box().scrollsOverflowY(); 1205 needsVerticalScrollbar = box().scrollsOverflowY();
1206 1206
1207 // Don't add auto scrollbars if the box contents aren't visible. 1207 // Don't add auto scrollbars if the box contents aren't visible.
1208 if (box().hasAutoHorizontalScrollbar()) { 1208 if (box().hasAutoHorizontalScrollbar()) {
1209 if (option == ForbidAddingAutoBars) 1209 if (option == ForbidAddingAutoBars)
1210 needsHorizontalScrollbar &= hasHorizontalScrollbar(); 1210 needsHorizontalScrollbar &= hasHorizontalScrollbar();
1211 needsHorizontalScrollbar &= box().isRooted() && 1211 needsHorizontalScrollbar &=
1212 this->hasHorizontalOverflow() && 1212 box().isRooted() && this->hasHorizontalOverflow() &&
1213 box().pixelSnappedClientHeight(); 1213 box().pixelSnappedClientHeight() + box().horizontalScrollbarHeight() >
1214 0;
1214 } 1215 }
1215 1216
1216 if (box().hasAutoVerticalScrollbar()) { 1217 if (box().hasAutoVerticalScrollbar()) {
1217 if (option == ForbidAddingAutoBars) 1218 if (option == ForbidAddingAutoBars)
1218 needsVerticalScrollbar &= hasVerticalScrollbar(); 1219 needsVerticalScrollbar &= hasVerticalScrollbar();
1219 needsVerticalScrollbar &= box().isRooted() && this->hasVerticalOverflow() && 1220 needsVerticalScrollbar &=
1220 box().pixelSnappedClientWidth(); 1221 box().isRooted() && this->hasVerticalOverflow() &&
1222 box().pixelSnappedClientWidth() + box().verticalScrollbarWidth() > 0;
1221 } 1223 }
1222 1224
1223 // Look for the scrollbarModes and reset the needs Horizontal & vertical 1225 // Look for the scrollbarModes and reset the needs Horizontal & vertical
1224 // Scrollbar values based on scrollbarModes, as during force style change 1226 // Scrollbar values based on scrollbarModes, as during force style change
1225 // StyleResolver::styleForDocument returns documentStyle with no overflow 1227 // StyleResolver::styleForDocument returns documentStyle with no overflow
1226 // values, due to which we are destroying the scrollbars that were already 1228 // values, due to which we are destroying the scrollbars that were already
1227 // present. 1229 // present.
1228 if (box().isLayoutView()) { 1230 if (box().isLayoutView()) {
1229 if (LocalFrame* frame = box().frame()) { 1231 if (LocalFrame* frame = box().frame()) {
1230 if (FrameView* frameView = frame->view()) { 1232 if (FrameView* frameView = frame->view()) {
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
2134 2136
2135 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: 2137 void PaintLayerScrollableArea::DelayScrollOffsetClampScope::
2136 clampScrollableAreas() { 2138 clampScrollableAreas() {
2137 for (auto& scrollableArea : *s_needsClamp) 2139 for (auto& scrollableArea : *s_needsClamp)
2138 scrollableArea->clampScrollOffsetAfterOverflowChange(); 2140 scrollableArea->clampScrollOffsetAfterOverflowChange();
2139 delete s_needsClamp; 2141 delete s_needsClamp;
2140 s_needsClamp = nullptr; 2142 s_needsClamp = nullptr;
2141 } 2143 }
2142 2144
2143 } // namespace blink 2145 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698