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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
6 * 6 *
7 * Other contributors: 7 * Other contributors:
8 * Robert O'Callahan <roc+@cs.cmu.edu> 8 * Robert O'Callahan <roc+@cs.cmu.edu>
9 * David Baron <dbaron@fas.harvard.edu> 9 * David Baron <dbaron@fas.harvard.edu>
10 * Christian Biesinger <cbiesinger@gmail.com> 10 * Christian Biesinger <cbiesinger@gmail.com>
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 #include "core/layout/LayoutTheme.h" 64 #include "core/layout/LayoutTheme.h"
65 #include "core/layout/LayoutView.h" 65 #include "core/layout/LayoutView.h"
66 #include "core/layout/api/LayoutBoxItem.h" 66 #include "core/layout/api/LayoutBoxItem.h"
67 #include "core/layout/compositing/CompositedLayerMapping.h" 67 #include "core/layout/compositing/CompositedLayerMapping.h"
68 #include "core/layout/compositing/PaintLayerCompositor.h" 68 #include "core/layout/compositing/PaintLayerCompositor.h"
69 #include "core/loader/FrameLoaderClient.h" 69 #include "core/loader/FrameLoaderClient.h"
70 #include "core/page/ChromeClient.h" 70 #include "core/page/ChromeClient.h"
71 #include "core/page/FocusController.h" 71 #include "core/page/FocusController.h"
72 #include "core/page/Page.h" 72 #include "core/page/Page.h"
73 #include "core/page/scrolling/RootScrollerController.h" 73 #include "core/page/scrolling/RootScrollerController.h"
74 #include "core/page/scrolling/RootScrollerUtil.h"
74 #include "core/page/scrolling/ScrollingCoordinator.h" 75 #include "core/page/scrolling/ScrollingCoordinator.h"
76 #include "core/page/scrolling/TopDocumentRootScrollerController.h"
75 #include "core/paint/PaintLayerFragment.h" 77 #include "core/paint/PaintLayerFragment.h"
76 #include "platform/PlatformGestureEvent.h" 78 #include "platform/PlatformGestureEvent.h"
77 #include "platform/PlatformMouseEvent.h" 79 #include "platform/PlatformMouseEvent.h"
78 #include "platform/graphics/CompositorMutableProperties.h" 80 #include "platform/graphics/CompositorMutableProperties.h"
79 #include "platform/graphics/GraphicsLayer.h" 81 #include "platform/graphics/GraphicsLayer.h"
80 #include "platform/graphics/paint/DrawingRecorder.h" 82 #include "platform/graphics/paint/DrawingRecorder.h"
81 #include "platform/scroll/ScrollAnimatorBase.h" 83 #include "platform/scroll/ScrollAnimatorBase.h"
82 #include "platform/scroll/ScrollbarTheme.h" 84 #include "platform/scroll/ScrollbarTheme.h"
83 #include "public/platform/Platform.h" 85 #include "public/platform/Platform.h"
84 86
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 if (scrollOriginChanged()) 800 if (scrollOriginChanged())
799 setScrollOffsetUnconditionally(clampScrollOffset(scrollOffset())); 801 setScrollOffsetUnconditionally(clampScrollOffset(scrollOffset()));
800 else 802 else
801 ScrollableArea::setScrollOffset(scrollOffset(), ClampingScroll); 803 ScrollableArea::setScrollOffset(scrollOffset(), ClampingScroll);
802 804
803 setNeedsScrollOffsetClamp(false); 805 setNeedsScrollOffsetClamp(false);
804 resetScrollOriginChanged(); 806 resetScrollOriginChanged();
805 m_scrollbarManager.destroyDetachedScrollbars(); 807 m_scrollbarManager.destroyDetachedScrollbars();
806 } 808 }
807 809
810 void PaintLayerScrollableArea::didChangeGlobalRootScroller() {
811 // On Android, where the VisualViewport supplies scrollbars, we need to
812 // remove the PLSA's scrollbars. In general, this would be problematic as
813 // that can cause layout but this should only ever apply with overlay
814 // scrollbars.
815 if (!box().frame()->settings() ||
816 !box().frame()->settings()->viewportEnabled())
817 return;
818
819 bool needsHorizontalScrollbar;
820 bool needsVerticalScrollbar;
821 computeScrollbarExistence(needsHorizontalScrollbar, needsVerticalScrollbar);
822 setHasHorizontalScrollbar(needsHorizontalScrollbar);
823 setHasVerticalScrollbar(needsVerticalScrollbar);
824 }
825
808 bool PaintLayerScrollableArea::shouldPerformScrollAnchoring() const { 826 bool PaintLayerScrollableArea::shouldPerformScrollAnchoring() const {
809 return RuntimeEnabledFeatures::scrollAnchoringEnabled() && 827 return RuntimeEnabledFeatures::scrollAnchoringEnabled() &&
810 m_scrollAnchor.hasScroller() && 828 m_scrollAnchor.hasScroller() &&
811 layoutBox()->style()->overflowAnchor() != AnchorNone && 829 layoutBox()->style()->overflowAnchor() != AnchorNone &&
812 !box().document().finishingOrIsPrinting(); 830 !box().document().finishingOrIsPrinting();
813 } 831 }
814 832
815 FloatQuad PaintLayerScrollableArea::localToVisibleContentQuad( 833 FloatQuad PaintLayerScrollableArea::localToVisibleContentQuad(
816 const FloatQuad& quad, 834 const FloatQuad& quad,
817 const LayoutObject* localObject, 835 const LayoutObject* localObject,
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
1721 1739
1722 void PaintLayerScrollableArea::setTopmostScrollChild(PaintLayer* scrollChild) { 1740 void PaintLayerScrollableArea::setTopmostScrollChild(PaintLayer* scrollChild) {
1723 // We only want to track the topmost scroll child for scrollable areas with 1741 // We only want to track the topmost scroll child for scrollable areas with
1724 // overlay scrollbars. 1742 // overlay scrollbars.
1725 if (!hasOverlayScrollbars()) 1743 if (!hasOverlayScrollbars())
1726 return; 1744 return;
1727 m_nextTopmostScrollChild = scrollChild; 1745 m_nextTopmostScrollChild = scrollChild;
1728 } 1746 }
1729 1747
1730 bool PaintLayerScrollableArea::visualViewportSuppliesScrollbars() const { 1748 bool PaintLayerScrollableArea::visualViewportSuppliesScrollbars() const {
1731 if (!layer()->isRootLayer()) 1749 LocalFrame* frame = box().frame();
1750 if (!frame || !frame->settings())
1732 return false; 1751 return false;
1733 1752
1734 LocalFrame* frame = box().frame(); 1753 // On desktop, we always use the layout viewport's scrollbars.
1735 if (!frame || !frame->isMainFrame() || !frame->settings()) 1754 if (!frame->settings()->viewportEnabled())
1736 return false; 1755 return false;
1737 1756
1738 return frame->settings()->viewportEnabled(); 1757 const TopDocumentRootScrollerController& controller =
1758 layoutBox()->document().frameHost()->globalRootScrollerController();
1759
1760 if (!controller.globalRootScroller())
1761 return false;
1762
1763 return RootScrollerUtil::scrollableAreaFor(
1764 *controller.globalRootScroller()) == this;
1739 } 1765 }
1740 1766
1741 Widget* PaintLayerScrollableArea::getWidget() { 1767 Widget* PaintLayerScrollableArea::getWidget() {
1742 return box().frame()->view(); 1768 return box().frame()->view();
1743 } 1769 }
1744 1770
1745 void PaintLayerScrollableArea::resetRebuildScrollbarLayerFlags() { 1771 void PaintLayerScrollableArea::resetRebuildScrollbarLayerFlags() {
1746 m_rebuildHorizontalScrollbarLayer = false; 1772 m_rebuildHorizontalScrollbarLayer = false;
1747 m_rebuildVerticalScrollbarLayer = false; 1773 m_rebuildVerticalScrollbarLayer = false;
1748 } 1774 }
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1967 1993
1968 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: 1994 void PaintLayerScrollableArea::DelayScrollOffsetClampScope::
1969 clampScrollableAreas() { 1995 clampScrollableAreas() {
1970 for (auto& scrollableArea : *s_needsClamp) 1996 for (auto& scrollableArea : *s_needsClamp)
1971 scrollableArea->clampScrollOffsetsAfterLayout(); 1997 scrollableArea->clampScrollOffsetsAfterLayout();
1972 delete s_needsClamp; 1998 delete s_needsClamp;
1973 s_needsClamp = nullptr; 1999 s_needsClamp = nullptr;
1974 } 2000 }
1975 2001
1976 } // namespace blink 2002 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698