OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 (!ScrollbarTheme::theme().usesOverlayScrollbars()) | |
816 return; | |
817 | |
818 bool needsHorizontalScrollbar; | |
819 bool needsVerticalScrollbar; | |
820 computeScrollbarExistence(needsHorizontalScrollbar, needsVerticalScrollbar); | |
821 setHasHorizontalScrollbar(needsHorizontalScrollbar); | |
822 setHasVerticalScrollbar(needsVerticalScrollbar); | |
823 } | |
824 | |
808 bool PaintLayerScrollableArea::shouldPerformScrollAnchoring() const { | 825 bool PaintLayerScrollableArea::shouldPerformScrollAnchoring() const { |
809 return RuntimeEnabledFeatures::scrollAnchoringEnabled() && | 826 return RuntimeEnabledFeatures::scrollAnchoringEnabled() && |
810 m_scrollAnchor.hasScroller() && | 827 m_scrollAnchor.hasScroller() && |
811 layoutBox()->style()->overflowAnchor() != AnchorNone && | 828 layoutBox()->style()->overflowAnchor() != AnchorNone && |
812 !box().document().finishingOrIsPrinting(); | 829 !box().document().finishingOrIsPrinting(); |
813 } | 830 } |
814 | 831 |
815 FloatQuad PaintLayerScrollableArea::localToVisibleContentQuad( | 832 FloatQuad PaintLayerScrollableArea::localToVisibleContentQuad( |
816 const FloatQuad& quad, | 833 const FloatQuad& quad, |
817 const LayoutObject* localObject, | 834 const LayoutObject* localObject, |
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1721 | 1738 |
1722 void PaintLayerScrollableArea::setTopmostScrollChild(PaintLayer* scrollChild) { | 1739 void PaintLayerScrollableArea::setTopmostScrollChild(PaintLayer* scrollChild) { |
1723 // We only want to track the topmost scroll child for scrollable areas with | 1740 // We only want to track the topmost scroll child for scrollable areas with |
1724 // overlay scrollbars. | 1741 // overlay scrollbars. |
1725 if (!hasOverlayScrollbars()) | 1742 if (!hasOverlayScrollbars()) |
1726 return; | 1743 return; |
1727 m_nextTopmostScrollChild = scrollChild; | 1744 m_nextTopmostScrollChild = scrollChild; |
1728 } | 1745 } |
1729 | 1746 |
1730 bool PaintLayerScrollableArea::visualViewportSuppliesScrollbars() const { | 1747 bool PaintLayerScrollableArea::visualViewportSuppliesScrollbars() const { |
1731 if (!layer()->isRootLayer()) | 1748 LocalFrame* frame = box().frame(); |
1749 if (!frame || !frame->settings()) | |
1732 return false; | 1750 return false; |
1733 | 1751 |
1734 LocalFrame* frame = box().frame(); | 1752 // On desktop, we always use the layout viewport's scrollbars. |
1735 if (!frame || !frame->isMainFrame() || !frame->settings()) | 1753 if (!frame->settings()->viewportEnabled()) |
1736 return false; | 1754 return false; |
1737 | 1755 |
1738 return frame->settings()->viewportEnabled(); | 1756 const TopDocumentRootScrollerController& controller = |
1757 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.
| |
1758 | |
1759 if (!controller.globalRootScroller()) | |
1760 return false; | |
1761 | |
1762 return RootScrollerUtil::scrollableAreaFor( | |
1763 *controller.globalRootScroller()) == this; | |
1739 } | 1764 } |
1740 | 1765 |
1741 Widget* PaintLayerScrollableArea::getWidget() { | 1766 Widget* PaintLayerScrollableArea::getWidget() { |
1742 return box().frame()->view(); | 1767 return box().frame()->view(); |
1743 } | 1768 } |
1744 | 1769 |
1745 void PaintLayerScrollableArea::resetRebuildScrollbarLayerFlags() { | 1770 void PaintLayerScrollableArea::resetRebuildScrollbarLayerFlags() { |
1746 m_rebuildHorizontalScrollbarLayer = false; | 1771 m_rebuildHorizontalScrollbarLayer = false; |
1747 m_rebuildVerticalScrollbarLayer = false; | 1772 m_rebuildVerticalScrollbarLayer = false; |
1748 } | 1773 } |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1967 | 1992 |
1968 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: | 1993 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: |
1969 clampScrollableAreas() { | 1994 clampScrollableAreas() { |
1970 for (auto& scrollableArea : *s_needsClamp) | 1995 for (auto& scrollableArea : *s_needsClamp) |
1971 scrollableArea->clampScrollOffsetsAfterLayout(); | 1996 scrollableArea->clampScrollOffsetsAfterLayout(); |
1972 delete s_needsClamp; | 1997 delete s_needsClamp; |
1973 s_needsClamp = nullptr; | 1998 s_needsClamp = nullptr; |
1974 } | 1999 } |
1975 | 2000 |
1976 } // namespace blink | 2001 } // namespace blink |
OLD | NEW |