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

Unified Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2509843004: Disable overlay scrollbars to hide them on non-Mac. (Closed)
Patch Set: Renamed to shouldDisableInvisibleScrollbars Created 4 years, 1 month 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
Index: third_party/WebKit/Source/core/frame/FrameView.cpp
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp
index 1a18940f27ba61f5dcab695b4fbeae4ef4d7c6fb..29f8edc568216fac37168115c23064660faab7af 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -2463,6 +2463,7 @@ bool FrameView::scrollbarsCanBeActive() const {
}
void FrameView::scrollbarVisibilityChanged() {
+ updateScrollbarEnabledState();
LayoutViewItem viewItem = layoutViewItem();
if (!viewItem.isNull())
viewItem.clearHitTestCache();
@@ -3824,10 +3825,25 @@ void FrameView::computeScrollbarExistence(
}
}
+void FrameView::updateScrollbarEnabledState() {
+ bool forceDisabled =
+ ScrollbarTheme::theme().shouldDisableInvisibleScrollbars() &&
+ scrollbarsHidden();
+
+ if (horizontalScrollbar()) {
+ horizontalScrollbar()->setEnabled(contentsWidth() > visibleWidth() &&
+ !forceDisabled);
+ }
+ if (verticalScrollbar()) {
+ verticalScrollbar()->setEnabled(contentsHeight() > visibleHeight() &&
+ !forceDisabled);
+ }
+}
+
void FrameView::updateScrollbarGeometry() {
+ updateScrollbarEnabledState();
if (horizontalScrollbar()) {
int thickness = horizontalScrollbar()->scrollbarThickness();
- int clientWidth = visibleWidth();
IntRect oldRect(horizontalScrollbar()->frameRect());
IntRect hBarRect(
(shouldPlaceVerticalScrollbarOnLeft() && verticalScrollbar())
@@ -3840,14 +3856,12 @@ void FrameView::updateScrollbarGeometry() {
if (oldRect != horizontalScrollbar()->frameRect())
setScrollbarNeedsPaintInvalidation(HorizontalScrollbar);
- horizontalScrollbar()->setEnabled(contentsWidth() > clientWidth);
- horizontalScrollbar()->setProportion(clientWidth, contentsWidth());
+ horizontalScrollbar()->setProportion(visibleWidth(), contentsWidth());
horizontalScrollbar()->offsetDidChange();
}
if (verticalScrollbar()) {
int thickness = verticalScrollbar()->scrollbarThickness();
- int clientHeight = visibleHeight();
IntRect oldRect(verticalScrollbar()->frameRect());
IntRect vBarRect(
shouldPlaceVerticalScrollbarOnLeft() ? 0 : (width() - thickness), 0,
@@ -3858,8 +3872,7 @@ void FrameView::updateScrollbarGeometry() {
if (oldRect != verticalScrollbar()->frameRect())
setScrollbarNeedsPaintInvalidation(VerticalScrollbar);
- verticalScrollbar()->setEnabled(contentsHeight() > clientHeight);
- verticalScrollbar()->setProportion(clientHeight, contentsHeight());
+ verticalScrollbar()->setProportion(visibleHeight(), contentsHeight());
verticalScrollbar()->offsetDidChange();
}
}
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.h ('k') | third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698