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

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

Issue 2509843004: Disable overlay scrollbars to hide them on non-Mac. (Closed)
Patch Set: Fix tests 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 d7af7ba56a5426ac3ae365a376c9ffdab5dac2b4..9986c9ead1071adddccfdad45ee638f3427749ca 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -2462,6 +2462,7 @@ bool FrameView::scrollbarsCanBeActive() const {
}
void FrameView::scrollbarVisibilityChanged() {
+ updateScrollbarEnabledState();
LayoutViewItem viewItem = layoutViewItem();
if (!viewItem.isNull())
viewItem.clearHitTestCache();
@@ -3791,10 +3792,24 @@ void FrameView::computeScrollbarExistence(
}
}
+void FrameView::updateScrollbarEnabledState() {
+ bool forceDisabled = ScrollbarTheme::theme().disableInvisibleScrollbars() &&
+ 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())
@@ -3807,14 +3822,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,
@@ -3825,8 +3838,7 @@ void FrameView::updateScrollbarGeometry() {
if (oldRect != verticalScrollbar()->frameRect())
setScrollbarNeedsPaintInvalidation(VerticalScrollbar);
- verticalScrollbar()->setEnabled(contentsHeight() > clientHeight);
- verticalScrollbar()->setProportion(clientHeight, contentsHeight());
+ verticalScrollbar()->setProportion(visibleHeight(), contentsHeight());
verticalScrollbar()->offsetDidChange();
}
}

Powered by Google App Engine
This is Rietveld 408576698