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

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

Issue 2501723003: Disable scrollbars on the root scroller when using visual viewport scrollbars. (Closed)
Patch Set: Fix (?) Graphics2D test 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..bfb6a6b1c35d061bca81b00efe0d62f30baae28b 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -89,6 +89,7 @@
#include "core/page/FocusController.h"
#include "core/page/FrameTree.h"
#include "core/page/Page.h"
+#include "core/page/scrolling/RootScrollerUtil.h"
#include "core/page/scrolling/ScrollingCoordinator.h"
#include "core/page/scrolling/TopDocumentRootScrollerController.h"
#include "core/paint/FramePainter.h"
@@ -1967,18 +1968,18 @@ void FrameView::scrollbarExistenceDidChange() {
if (!frame().view())
return;
- bool hasOverlayScrollbars = this->hasOverlayScrollbars();
+ bool usesOverlayScrollbars = ScrollbarTheme::theme().usesOverlayScrollbars();
// FIXME: this call to layout() could be called within FrameView::layout(),
// but before performLayout(), causing double-layout. See also
// crbug.com/429242.
- if (!hasOverlayScrollbars && needsLayout())
+ if (!usesOverlayScrollbars && needsLayout())
layout();
if (!layoutViewItem().isNull() && layoutViewItem().usesCompositing()) {
layoutViewItem().compositor()->frameViewScrollbarsExistenceDidChange();
- if (!hasOverlayScrollbars)
+ if (!usesOverlayScrollbars)
layoutViewItem().compositor()->frameViewDidChangeSize();
}
}
@@ -2667,6 +2668,25 @@ FrameView* FrameView::parentFrameView() const {
return nullptr;
}
+void FrameView::didChangeGlobalRootScroller() {
+ if (!m_frame->settings() || !m_frame->settings()->viewportEnabled())
+ return;
+
+ // Avoid drawing two sets of scrollbars when visual viewport is enabled.
+ bool hasHorizontalScrollbar = horizontalScrollbar();
+ bool hasVerticalScrollbar = verticalScrollbar();
+ bool shouldHaveHorizontalScrollbar = false;
+ bool shouldHaveVerticalScrollbar = false;
+ computeScrollbarExistence(shouldHaveHorizontalScrollbar,
+ shouldHaveVerticalScrollbar, contentsSize());
+ m_scrollbarManager.setHasHorizontalScrollbar(shouldHaveHorizontalScrollbar);
+ m_scrollbarManager.setHasVerticalScrollbar(shouldHaveVerticalScrollbar);
+
+ if (hasHorizontalScrollbar != shouldHaveHorizontalScrollbar ||
+ hasVerticalScrollbar != shouldHaveVerticalScrollbar)
+ scrollbarExistenceDidChange();
+}
+
void FrameView::updateWidgetGeometriesIfNeeded() {
if (!m_needsUpdateWidgetGeometries)
return;
@@ -3491,9 +3511,21 @@ void FrameView::removeChild(Widget* child) {
m_children.remove(child);
}
-bool FrameView::visualViewportSuppliesScrollbars() const {
- return m_frame->isMainFrame() && m_frame->settings() &&
- m_frame->settings()->viewportEnabled();
+bool FrameView::visualViewportSuppliesScrollbars() {
+ // On desktop, we always use the layout viewport's scrollbars.
+ if (!m_frame->settings() || !m_frame->settings()->viewportEnabled() ||
+ !m_frame->document() || !m_frame->host())
+ return false;
+
+ const TopDocumentRootScrollerController& controller =
+ m_frame->host()->globalRootScrollerController();
+
+ if (!controller.globalRootScroller())
+ return false;
+
+ return RootScrollerUtil::scrollableAreaFor(
+ *controller.globalRootScroller()) ==
+ layoutViewportScrollableArea();
}
AXObjectCache* FrameView::axObjectCache() const {
@@ -3742,8 +3774,9 @@ void FrameView::computeScrollbarExistence(
bool& newHasHorizontalScrollbar,
bool& newHasVerticalScrollbar,
const IntSize& docSize,
- ComputeScrollbarExistenceOption option) const {
- if (m_frame->settings() && m_frame->settings()->hideScrollbars()) {
+ ComputeScrollbarExistenceOption option) {
+ if ((m_frame->settings() && m_frame->settings()->hideScrollbars()) ||
+ visualViewportSuppliesScrollbars()) {
newHasHorizontalScrollbar = false;
newHasVerticalScrollbar = false;
return;

Powered by Google App Engine
This is Rietveld 408576698