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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/page/scrolling/TopDocumentRootScrollerController.cpp
diff --git a/third_party/WebKit/Source/core/page/scrolling/TopDocumentRootScrollerController.cpp b/third_party/WebKit/Source/core/page/scrolling/TopDocumentRootScrollerController.cpp
index 1f0519209343c98598648bb3c014ddc4c4081846..270b7c55e2408516c9bd21a83341f8c5482ecfc3 100644
--- a/third_party/WebKit/Source/core/page/scrolling/TopDocumentRootScrollerController.cpp
+++ b/third_party/WebKit/Source/core/page/scrolling/TopDocumentRootScrollerController.cpp
@@ -8,6 +8,8 @@
#include "core/dom/Element.h"
#include "core/frame/FrameHost.h"
#include "core/frame/FrameView.h"
+#include "core/frame/PageScaleConstraintsSet.h"
+#include "core/frame/VisualViewport.h"
#include "core/html/HTMLFrameOwnerElement.h"
#include "core/layout/LayoutView.h"
#include "core/layout/compositing/PaintLayerCompositor.h"
@@ -60,6 +62,24 @@ void TopDocumentRootScrollerController::mainFrameViewResized() {
}
}
+ScrollableArea* TopDocumentRootScrollerController::rootScrollerArea() const {
+ return RootScrollerUtil::scrollableAreaForRootScroller(globalRootScroller());
+}
+
+IntSize TopDocumentRootScrollerController::rootScrollerVisibleArea() const {
+ if (!topDocument() || !topDocument()->view())
+ return IntSize();
+
+ float minimumPageScale =
+ m_frameHost->pageScaleConstraintsSet().finalConstraints().minimumScale;
+ int browserControlsAdjustment =
+ ceilf(m_frameHost->visualViewport().browserControlsAdjustment() /
+ minimumPageScale);
+
+ return topDocument()->view()->visibleContentSize(ExcludeScrollbars) +
+ IntSize(0, browserControlsAdjustment);
+}
+
Element* TopDocumentRootScrollerController::findGlobalRootScrollerElement() {
if (!topDocument())
return nullptr;

Powered by Google App Engine
This is Rietveld 408576698