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

Side by Side Diff: third_party/WebKit/Source/core/page/scrolling/TopDocumentRootScrollerController.cpp

Issue 2622103002: Generalize browser controls adjustment for arbitrary scrollers. (Closed)
Patch Set: Fixed some comments Created 3 years, 11 months 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/page/scrolling/TopDocumentRootScrollerController.h" 5 #include "core/page/scrolling/TopDocumentRootScrollerController.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/dom/Element.h" 8 #include "core/dom/Element.h"
9 #include "core/frame/FrameHost.h" 9 #include "core/frame/FrameHost.h"
10 #include "core/frame/FrameView.h" 10 #include "core/frame/FrameView.h"
11 #include "core/frame/PageScaleConstraintsSet.h"
12 #include "core/frame/VisualViewport.h"
11 #include "core/html/HTMLFrameOwnerElement.h" 13 #include "core/html/HTMLFrameOwnerElement.h"
12 #include "core/layout/LayoutView.h" 14 #include "core/layout/LayoutView.h"
13 #include "core/layout/compositing/PaintLayerCompositor.h" 15 #include "core/layout/compositing/PaintLayerCompositor.h"
14 #include "core/page/ChromeClient.h" 16 #include "core/page/ChromeClient.h"
15 #include "core/page/Page.h" 17 #include "core/page/Page.h"
16 #include "core/page/scrolling/OverscrollController.h" 18 #include "core/page/scrolling/OverscrollController.h"
17 #include "core/page/scrolling/RootScrollerUtil.h" 19 #include "core/page/scrolling/RootScrollerUtil.h"
18 #include "core/page/scrolling/ViewportScrollCallback.h" 20 #include "core/page/scrolling/ViewportScrollCallback.h"
19 #include "core/paint/PaintLayer.h" 21 #include "core/paint/PaintLayer.h"
20 #include "platform/scroll/ScrollableArea.h" 22 #include "platform/scroll/ScrollableArea.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 if (PaintLayer* layer = area->layer()) { 55 if (PaintLayer* layer = area->layer()) {
54 layer->setNeedsCompositingInputsUpdate(); 56 layer->setNeedsCompositingInputsUpdate();
55 57
56 // This is needed if the root scroller is an iframe, since the iframe 58 // This is needed if the root scroller is an iframe, since the iframe
57 // doesn't have a scrolling/clip layer, its PLC has a container layer that 59 // doesn't have a scrolling/clip layer, its PLC has a container layer that
58 // needs to be resized instead. 60 // needs to be resized instead.
59 layer->compositor()->frameViewDidChangeSize(); 61 layer->compositor()->frameViewDidChangeSize();
60 } 62 }
61 } 63 }
62 64
65 ScrollableArea* TopDocumentRootScrollerController::rootScrollerArea() const {
66 return RootScrollerUtil::scrollableAreaForRootScroller(globalRootScroller());
67 }
68
69 IntSize TopDocumentRootScrollerController::rootScrollerVisibleArea() const {
70 if (!topDocument() || !topDocument()->view())
71 return IntSize();
72
73 float minimumPageScale =
74 m_frameHost->pageScaleConstraintsSet().finalConstraints().minimumScale;
75 int browserControlsAdjustment =
76 ceilf(m_frameHost->visualViewport().browserControlsAdjustment() /
77 minimumPageScale);
78
79 return topDocument()->view()->visibleContentSize(ExcludeScrollbars) +
80 IntSize(0, browserControlsAdjustment);
81 }
82
63 Element* TopDocumentRootScrollerController::findGlobalRootScrollerElement() { 83 Element* TopDocumentRootScrollerController::findGlobalRootScrollerElement() {
64 if (!topDocument()) 84 if (!topDocument())
65 return nullptr; 85 return nullptr;
66 86
67 Node* effectiveRootScroller = 87 Node* effectiveRootScroller =
68 &topDocument()->rootScrollerController().effectiveRootScroller(); 88 &topDocument()->rootScrollerController().effectiveRootScroller();
69 89
70 if (effectiveRootScroller->isDocumentNode()) 90 if (effectiveRootScroller->isDocumentNode())
71 return topDocument()->documentElement(); 91 return topDocument()->documentElement();
72 92
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 257
238 PaintLayer* TopDocumentRootScrollerController::rootScrollerPaintLayer() const { 258 PaintLayer* TopDocumentRootScrollerController::rootScrollerPaintLayer() const {
239 return RootScrollerUtil::paintLayerForRootScroller(m_globalRootScroller); 259 return RootScrollerUtil::paintLayerForRootScroller(m_globalRootScroller);
240 } 260 }
241 261
242 Element* TopDocumentRootScrollerController::globalRootScroller() const { 262 Element* TopDocumentRootScrollerController::globalRootScroller() const {
243 return m_globalRootScroller.get(); 263 return m_globalRootScroller.get();
244 } 264 }
245 265
246 } // namespace blink 266 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698