Chromium Code Reviews| Index: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp |
| diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp |
| index f4d15b2eedadc3050bed99b495cc9f3bc1f32b17..770ebf83fb1fa8eb493796a8fd045562d0d49aa8 100644 |
| --- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp |
| +++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp |
| @@ -71,7 +71,9 @@ |
| #include "core/page/FocusController.h" |
| #include "core/page/Page.h" |
| #include "core/page/scrolling/RootScrollerController.h" |
| +#include "core/page/scrolling/RootScrollerUtil.h" |
| #include "core/page/scrolling/ScrollingCoordinator.h" |
| +#include "core/page/scrolling/TopDocumentRootScrollerController.h" |
| #include "core/paint/PaintLayerFragment.h" |
| #include "platform/PlatformGestureEvent.h" |
| #include "platform/PlatformMouseEvent.h" |
| @@ -805,6 +807,21 @@ void PaintLayerScrollableArea::clampScrollOffsetsAfterLayout() { |
| m_scrollbarManager.destroyDetachedScrollbars(); |
| } |
| +void PaintLayerScrollableArea::didChangeGlobalRootScroller() { |
| + // On Android, where the VisualViewport supplies scrollbars, we need to |
| + // remove the PLSA's scrollbars. In general, this would be problematic as |
| + // that can cause layout but this should only ever apply with overlay |
| + // scrollbars. |
| + if (!ScrollbarTheme::theme().usesOverlayScrollbars()) |
| + return; |
| + |
| + bool needsHorizontalScrollbar; |
| + bool needsVerticalScrollbar; |
| + computeScrollbarExistence(needsHorizontalScrollbar, needsVerticalScrollbar); |
| + setHasHorizontalScrollbar(needsHorizontalScrollbar); |
| + setHasVerticalScrollbar(needsVerticalScrollbar); |
| +} |
| + |
| bool PaintLayerScrollableArea::shouldPerformScrollAnchoring() const { |
| return RuntimeEnabledFeatures::scrollAnchoringEnabled() && |
| m_scrollAnchor.hasScroller() && |
| @@ -1728,14 +1745,22 @@ void PaintLayerScrollableArea::setTopmostScrollChild(PaintLayer* scrollChild) { |
| } |
| bool PaintLayerScrollableArea::visualViewportSuppliesScrollbars() const { |
| - if (!layer()->isRootLayer()) |
| + LocalFrame* frame = box().frame(); |
| + if (!frame || !frame->settings()) |
| return false; |
| - LocalFrame* frame = box().frame(); |
| - if (!frame || !frame->isMainFrame() || !frame->settings()) |
| + // On desktop, we always use the layout viewport's scrollbars. |
| + if (!frame->settings()->viewportEnabled()) |
| + return false; |
| + |
| + const TopDocumentRootScrollerController& controller = |
| + layoutBox()->document().frameHost()->globalRootScrollerController(); |
|
skobes
2016/11/15 20:18:44
You could just do frame->host() here.
bokan
2016/11/15 22:04:10
Done.
|
| + |
| + if (!controller.globalRootScroller()) |
| return false; |
| - return frame->settings()->viewportEnabled(); |
| + return RootScrollerUtil::scrollableAreaFor( |
| + *controller.globalRootScroller()) == this; |
| } |
| Widget* PaintLayerScrollableArea::getWidget() { |