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

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

Issue 2732363003: Make TopDocumentRootScrollerController store Page instead of FrameHost (Closed)
Patch Set: Review feedback Created 3 years, 9 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 412c44bd00f439e92818011b3310f3a657b1e176..082ce352bc03f06d0121d9e21a7130791b8b7200 100644
--- a/third_party/WebKit/Source/core/page/scrolling/TopDocumentRootScrollerController.cpp
+++ b/third_party/WebKit/Source/core/page/scrolling/TopDocumentRootScrollerController.cpp
@@ -25,18 +25,17 @@ namespace blink {
// static
TopDocumentRootScrollerController* TopDocumentRootScrollerController::create(
- FrameHost& host) {
- return new TopDocumentRootScrollerController(host);
+ Page& page) {
+ return new TopDocumentRootScrollerController(page);
}
-TopDocumentRootScrollerController::TopDocumentRootScrollerController(
- FrameHost& host)
- : m_frameHost(&host) {}
+TopDocumentRootScrollerController::TopDocumentRootScrollerController(Page& page)
+ : m_page(&page) {}
DEFINE_TRACE(TopDocumentRootScrollerController) {
visitor->trace(m_viewportApplyScroll);
visitor->trace(m_globalRootScroller);
- visitor->trace(m_frameHost);
+ visitor->trace(m_page);
}
void TopDocumentRootScrollerController::didChangeRootScroller() {
@@ -70,10 +69,12 @@ IntSize TopDocumentRootScrollerController::rootScrollerVisibleArea() const {
if (!topDocument() || !topDocument()->view())
return IntSize();
- float minimumPageScale =
- m_frameHost->pageScaleConstraintsSet().finalConstraints().minimumScale;
+ float minimumPageScale = m_page->frameHost()
+ .pageScaleConstraintsSet()
+ .finalConstraints()
+ .minimumScale;
int browserControlsAdjustment =
- ceilf(m_frameHost->visualViewport().browserControlsAdjustment() /
+ ceilf(m_page->frameHost().visualViewport().browserControlsAdjustment() /
minimumPageScale);
return topDocument()->view()->visibleContentSize(ExcludeScrollbars) +
@@ -166,14 +167,13 @@ void TopDocumentRootScrollerController::recomputeGlobalRootScroller() {
}
Document* TopDocumentRootScrollerController::topDocument() const {
- if (!m_frameHost)
+ if (!m_page)
return nullptr;
- if (!m_frameHost->page().mainFrame() ||
- !m_frameHost->page().mainFrame()->isLocalFrame())
+ if (!m_page->mainFrame() || !m_page->mainFrame()->isLocalFrame())
return nullptr;
joelhockey 2017/03/08 06:02:52 It would make a lot of sense to combine the 2 if-s
sashab 2017/03/08 23:39:31 Thanks, good idea! Combined them. I tried a terna
- return toLocalFrame(m_frameHost->page().mainFrame())->document();
+ return toLocalFrame(m_page->mainFrame())->document();
}
void TopDocumentRootScrollerController::
@@ -194,11 +194,11 @@ void TopDocumentRootScrollerController::
}
void TopDocumentRootScrollerController::didUpdateCompositing() {
- if (!m_frameHost)
+ if (!m_page)
return;
// Let the compositor-side counterpart know about this change.
- m_frameHost->page().chromeClient().registerViewportLayers();
+ m_page->chromeClient().registerViewportLayers();
}
void TopDocumentRootScrollerController::didDisposeScrollableArea(
@@ -223,10 +223,10 @@ void TopDocumentRootScrollerController::didDisposeScrollableArea(
void TopDocumentRootScrollerController::initializeViewportScrollCallback(
RootFrameViewport& rootFrameViewport) {
- DCHECK(m_frameHost);
+ DCHECK(m_page);
m_viewportApplyScroll = ViewportScrollCallback::create(
- &m_frameHost->browserControls(), &m_frameHost->overscrollController(),
- rootFrameViewport);
+ &m_page->frameHost().browserControls(),
+ &m_page->frameHost().overscrollController(), rootFrameViewport);
recomputeGlobalRootScroller();
}

Powered by Google App Engine
This is Rietveld 408576698