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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 #include "core/layout/svg/LayoutSVGRoot.h" 82 #include "core/layout/svg/LayoutSVGRoot.h"
83 #include "core/loader/DocumentLoader.h" 83 #include "core/loader/DocumentLoader.h"
84 #include "core/loader/FrameLoader.h" 84 #include "core/loader/FrameLoader.h"
85 #include "core/loader/FrameLoaderClient.h" 85 #include "core/loader/FrameLoaderClient.h"
86 #include "core/observer/ResizeObserverController.h" 86 #include "core/observer/ResizeObserverController.h"
87 #include "core/page/AutoscrollController.h" 87 #include "core/page/AutoscrollController.h"
88 #include "core/page/ChromeClient.h" 88 #include "core/page/ChromeClient.h"
89 #include "core/page/FocusController.h" 89 #include "core/page/FocusController.h"
90 #include "core/page/FrameTree.h" 90 #include "core/page/FrameTree.h"
91 #include "core/page/Page.h" 91 #include "core/page/Page.h"
92 #include "core/page/scrolling/RootScrollerUtil.h"
92 #include "core/page/scrolling/ScrollingCoordinator.h" 93 #include "core/page/scrolling/ScrollingCoordinator.h"
93 #include "core/page/scrolling/TopDocumentRootScrollerController.h" 94 #include "core/page/scrolling/TopDocumentRootScrollerController.h"
94 #include "core/paint/FramePainter.h" 95 #include "core/paint/FramePainter.h"
95 #include "core/paint/PaintLayer.h" 96 #include "core/paint/PaintLayer.h"
96 #include "core/paint/PrePaintTreeWalk.h" 97 #include "core/paint/PrePaintTreeWalk.h"
97 #include "core/plugins/PluginView.h" 98 #include "core/plugins/PluginView.h"
98 #include "core/style/ComputedStyle.h" 99 #include "core/style/ComputedStyle.h"
99 #include "core/svg/SVGDocumentExtensions.h" 100 #include "core/svg/SVGDocumentExtensions.h"
100 #include "core/svg/SVGSVGElement.h" 101 #include "core/svg/SVGSVGElement.h"
101 #include "platform/Histogram.h" 102 #include "platform/Histogram.h"
(...skipping 1858 matching lines...) Expand 10 before | Expand all | Expand 10 after
1960 1961
1961 void FrameView::scrollbarExistenceDidChange() { 1962 void FrameView::scrollbarExistenceDidChange() {
1962 // We check to make sure the view is attached to a frame() as this method can 1963 // We check to make sure the view is attached to a frame() as this method can
1963 // be triggered before the view is attached by LocalFrame::createView(...) 1964 // be triggered before the view is attached by LocalFrame::createView(...)
1964 // setting various values such as setScrollBarModes(...) for example. An 1965 // setting various values such as setScrollBarModes(...) for example. An
1965 // ASSERT is triggered when a view is layout before being attached to a 1966 // ASSERT is triggered when a view is layout before being attached to a
1966 // frame(). 1967 // frame().
1967 if (!frame().view()) 1968 if (!frame().view())
1968 return; 1969 return;
1969 1970
1970 bool hasOverlayScrollbars = this->hasOverlayScrollbars(); 1971 bool usesOverlayScrollbars = ScrollbarTheme::theme().usesOverlayScrollbars();
1971 1972
1972 // FIXME: this call to layout() could be called within FrameView::layout(), 1973 // FIXME: this call to layout() could be called within FrameView::layout(),
1973 // but before performLayout(), causing double-layout. See also 1974 // but before performLayout(), causing double-layout. See also
1974 // crbug.com/429242. 1975 // crbug.com/429242.
1975 if (!hasOverlayScrollbars && needsLayout()) 1976 if (!usesOverlayScrollbars && needsLayout())
1976 layout(); 1977 layout();
1977 1978
1978 if (!layoutViewItem().isNull() && layoutViewItem().usesCompositing()) { 1979 if (!layoutViewItem().isNull() && layoutViewItem().usesCompositing()) {
1979 layoutViewItem().compositor()->frameViewScrollbarsExistenceDidChange(); 1980 layoutViewItem().compositor()->frameViewScrollbarsExistenceDidChange();
1980 1981
1981 if (!hasOverlayScrollbars) 1982 if (!usesOverlayScrollbars)
1982 layoutViewItem().compositor()->frameViewDidChangeSize(); 1983 layoutViewItem().compositor()->frameViewDidChangeSize();
1983 } 1984 }
1984 } 1985 }
1985 1986
1986 void FrameView::handleLoadCompleted() { 1987 void FrameView::handleLoadCompleted() {
1987 // Once loading has completed, allow autoSize one last opportunity to 1988 // Once loading has completed, allow autoSize one last opportunity to
1988 // reduce the size of the frame. 1989 // reduce the size of the frame.
1989 if (m_autoSizeInfo) 1990 if (m_autoSizeInfo)
1990 m_autoSizeInfo->autoSizeIfNeeded(); 1991 m_autoSizeInfo->autoSizeIfNeeded();
1991 1992
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
2660 if (!parent()) 2661 if (!parent())
2661 return nullptr; 2662 return nullptr;
2662 2663
2663 Frame* parentFrame = m_frame->tree().parent(); 2664 Frame* parentFrame = m_frame->tree().parent();
2664 if (parentFrame && parentFrame->isLocalFrame()) 2665 if (parentFrame && parentFrame->isLocalFrame())
2665 return toLocalFrame(parentFrame)->view(); 2666 return toLocalFrame(parentFrame)->view();
2666 2667
2667 return nullptr; 2668 return nullptr;
2668 } 2669 }
2669 2670
2671 void FrameView::didChangeGlobalRootScroller() {
2672 if (!m_frame->settings() || !m_frame->settings()->viewportEnabled())
2673 return;
2674
2675 // Avoid drawing two sets of scrollbars when visual viewport is enabled.
2676 bool hasHorizontalScrollbar = horizontalScrollbar();
2677 bool hasVerticalScrollbar = verticalScrollbar();
2678 bool shouldHaveHorizontalScrollbar = false;
2679 bool shouldHaveVerticalScrollbar = false;
2680 computeScrollbarExistence(shouldHaveHorizontalScrollbar,
2681 shouldHaveVerticalScrollbar, contentsSize());
2682 m_scrollbarManager.setHasHorizontalScrollbar(shouldHaveHorizontalScrollbar);
2683 m_scrollbarManager.setHasVerticalScrollbar(shouldHaveVerticalScrollbar);
2684
2685 if (hasHorizontalScrollbar != shouldHaveHorizontalScrollbar ||
2686 hasVerticalScrollbar != shouldHaveVerticalScrollbar)
2687 scrollbarExistenceDidChange();
2688 }
2689
2670 void FrameView::updateWidgetGeometriesIfNeeded() { 2690 void FrameView::updateWidgetGeometriesIfNeeded() {
2671 if (!m_needsUpdateWidgetGeometries) 2691 if (!m_needsUpdateWidgetGeometries)
2672 return; 2692 return;
2673 2693
2674 m_needsUpdateWidgetGeometries = false; 2694 m_needsUpdateWidgetGeometries = false;
2675 2695
2676 updateWidgetGeometries(); 2696 updateWidgetGeometries();
2677 } 2697 }
2678 2698
2679 void FrameView::updateAllLifecyclePhases() { 2699 void FrameView::updateAllLifecyclePhases() {
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
3484 void FrameView::removeChild(Widget* child) { 3504 void FrameView::removeChild(Widget* child) {
3485 ASSERT(child->parent() == this); 3505 ASSERT(child->parent() == this);
3486 3506
3487 if (child->isFrameView()) 3507 if (child->isFrameView())
3488 removeScrollableArea(toFrameView(child)); 3508 removeScrollableArea(toFrameView(child));
3489 3509
3490 child->setParent(0); 3510 child->setParent(0);
3491 m_children.remove(child); 3511 m_children.remove(child);
3492 } 3512 }
3493 3513
3494 bool FrameView::visualViewportSuppliesScrollbars() const { 3514 bool FrameView::visualViewportSuppliesScrollbars() {
3495 return m_frame->isMainFrame() && m_frame->settings() && 3515 // On desktop, we always use the layout viewport's scrollbars.
3496 m_frame->settings()->viewportEnabled(); 3516 if (!m_frame->settings() || !m_frame->settings()->viewportEnabled() ||
3517 !m_frame->document() || !m_frame->host())
3518 return false;
3519
3520 const TopDocumentRootScrollerController& controller =
3521 m_frame->host()->globalRootScrollerController();
3522
3523 if (!controller.globalRootScroller())
3524 return false;
3525
3526 return RootScrollerUtil::scrollableAreaFor(
3527 *controller.globalRootScroller()) ==
3528 layoutViewportScrollableArea();
3497 } 3529 }
3498 3530
3499 AXObjectCache* FrameView::axObjectCache() const { 3531 AXObjectCache* FrameView::axObjectCache() const {
3500 if (frame().document()) 3532 if (frame().document())
3501 return frame().document()->existingAXObjectCache(); 3533 return frame().document()->existingAXObjectCache();
3502 return nullptr; 3534 return nullptr;
3503 } 3535 }
3504 3536
3505 void FrameView::setCursor(const Cursor& cursor) { 3537 void FrameView::setCursor(const Cursor& cursor) {
3506 Page* page = frame().page(); 3538 Page* page = frame().page();
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
3735 bool FrameView::hasOverlayScrollbars() const { 3767 bool FrameView::hasOverlayScrollbars() const {
3736 return (horizontalScrollbar() && 3768 return (horizontalScrollbar() &&
3737 horizontalScrollbar()->isOverlayScrollbar()) || 3769 horizontalScrollbar()->isOverlayScrollbar()) ||
3738 (verticalScrollbar() && verticalScrollbar()->isOverlayScrollbar()); 3770 (verticalScrollbar() && verticalScrollbar()->isOverlayScrollbar());
3739 } 3771 }
3740 3772
3741 void FrameView::computeScrollbarExistence( 3773 void FrameView::computeScrollbarExistence(
3742 bool& newHasHorizontalScrollbar, 3774 bool& newHasHorizontalScrollbar,
3743 bool& newHasVerticalScrollbar, 3775 bool& newHasVerticalScrollbar,
3744 const IntSize& docSize, 3776 const IntSize& docSize,
3745 ComputeScrollbarExistenceOption option) const { 3777 ComputeScrollbarExistenceOption option) {
3746 if (m_frame->settings() && m_frame->settings()->hideScrollbars()) { 3778 if ((m_frame->settings() && m_frame->settings()->hideScrollbars()) ||
3779 visualViewportSuppliesScrollbars()) {
3747 newHasHorizontalScrollbar = false; 3780 newHasHorizontalScrollbar = false;
3748 newHasVerticalScrollbar = false; 3781 newHasVerticalScrollbar = false;
3749 return; 3782 return;
3750 } 3783 }
3751 3784
3752 bool hasHorizontalScrollbar = horizontalScrollbar(); 3785 bool hasHorizontalScrollbar = horizontalScrollbar();
3753 bool hasVerticalScrollbar = verticalScrollbar(); 3786 bool hasVerticalScrollbar = verticalScrollbar();
3754 3787
3755 newHasHorizontalScrollbar = hasHorizontalScrollbar; 3788 newHasHorizontalScrollbar = hasHorizontalScrollbar;
3756 newHasVerticalScrollbar = hasVerticalScrollbar; 3789 newHasVerticalScrollbar = hasVerticalScrollbar;
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
4585 DCHECK(m_frame->isMainFrame()); 4618 DCHECK(m_frame->isMainFrame());
4586 return m_initialViewportSize.width(); 4619 return m_initialViewportSize.width();
4587 } 4620 }
4588 4621
4589 int FrameView::initialViewportHeight() const { 4622 int FrameView::initialViewportHeight() const {
4590 DCHECK(m_frame->isMainFrame()); 4623 DCHECK(m_frame->isMainFrame());
4591 return m_initialViewportSize.height(); 4624 return m_initialViewportSize.height();
4592 } 4625 }
4593 4626
4594 } // namespace blink 4627 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698