| 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 216b78f2a864c8875e49195dd53f7aa3c8213749..3e44b959c9218a1aaae2a6823088c12f2f40ba9e 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"
|
| @@ -2673,6 +2674,19 @@ FrameView* FrameView::parentFrameView() const {
|
| return nullptr;
|
| }
|
|
|
| +void FrameView::didChangeGlobalRootScroller() {
|
| + if (!ScrollbarTheme::theme().usesOverlayScrollbars())
|
| + return;
|
| +
|
| + // Avoid drawing two sets of scrollbars when visual viewport is enabled.
|
| + bool shouldHaveHorizontalScrollbar = false;
|
| + bool shouldHaveVerticalScrollbar = false;
|
| + computeScrollbarExistence(shouldHaveHorizontalScrollbar,
|
| + shouldHaveVerticalScrollbar, contentsSize());
|
| + m_scrollbarManager.setHasHorizontalScrollbar(shouldHaveHorizontalScrollbar);
|
| + m_scrollbarManager.setHasVerticalScrollbar(shouldHaveVerticalScrollbar);
|
| +}
|
| +
|
| void FrameView::updateWidgetGeometriesIfNeeded() {
|
| if (!m_needsUpdateWidgetGeometries)
|
| return;
|
| @@ -3497,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->document()->frameHost())
|
| + return false;
|
| +
|
| + const TopDocumentRootScrollerController& controller =
|
| + m_frame->document()->frameHost()->globalRootScrollerController();
|
| +
|
| + if (!controller.globalRootScroller())
|
| + return false;
|
| +
|
| + return RootScrollerUtil::scrollableAreaFor(
|
| + *controller.globalRootScroller()) ==
|
| + layoutViewportScrollableArea();
|
| }
|
|
|
| AXObjectCache* FrameView::axObjectCache() const {
|
| @@ -3756,8 +3782,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;
|
|
|