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

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

Issue 2128553002: Make rootScroller the layout viewport. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@viewportScrollCallbackInterface
Patch Set: Replace the layout viewport with the root scroller Created 4 years, 5 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/RootViewportScrollCallback.cpp
diff --git a/third_party/WebKit/Source/core/page/scrolling/RootViewportScrollCallback.cpp b/third_party/WebKit/Source/core/page/scrolling/RootViewportScrollCallback.cpp
index d5b0de9a314fa2349b1252e1bb4a0e6a1eaaabdd..bfb83a3b0fa0ba33107507f155c7607c37d52ced 100644
--- a/third_party/WebKit/Source/core/page/scrolling/RootViewportScrollCallback.cpp
+++ b/third_party/WebKit/Source/core/page/scrolling/RootViewportScrollCallback.cpp
@@ -6,6 +6,7 @@
#include "core/frame/FrameHost.h"
#include "core/frame/FrameView.h"
+#include "core/frame/RootFrameViewport.h"
#include "core/frame/Settings.h"
#include "core/frame/TopControls.h"
#include "core/page/scrolling/OverscrollController.h"
@@ -16,9 +17,12 @@
namespace blink {
RootViewportScrollCallback::RootViewportScrollCallback(
- TopControls* topControls, OverscrollController* overscrollController)
+ TopControls* topControls,
+ OverscrollController* overscrollController,
+ RootFrameViewport* rootFrameViewport)
: m_topControls(topControls)
, m_overscrollController(overscrollController)
+ , m_rootFrameViewport(rootFrameViewport)
{
}
@@ -30,7 +34,7 @@ DEFINE_TRACE(RootViewportScrollCallback)
{
visitor->trace(m_topControls);
visitor->trace(m_overscrollController);
- visitor->trace(m_scroller);
+ visitor->trace(m_rootFrameViewport);
ViewportScrollCallback::trace(visitor);
}
@@ -40,11 +44,11 @@ bool RootViewportScrollCallback::shouldScrollTopControls(const FloatSize& delta,
if (granularity != ScrollByPixel && granularity != ScrollByPrecisePixel)
return false;
- if (!m_scroller)
+ if (!m_rootFrameViewport)
return false;
- DoublePoint maxScroll = m_scroller->maximumScrollPositionDouble();
- DoublePoint scrollPosition = m_scroller->scrollPositionDouble();
+ DoublePoint maxScroll = m_rootFrameViewport->maximumScrollPositionDouble();
+ DoublePoint scrollPosition = m_rootFrameViewport->scrollPositionDouble();
// Always give the delta to the top controls if the scroll is in
// the direction to show the top controls. If it's in the
@@ -72,10 +76,10 @@ void RootViewportScrollCallback::handleEvent(ScrollState* state)
bool topControlsConsumedScroll = remainingDelta.height() != delta.height();
// Scroll the element's scrollable area.
- if (!m_scroller)
+ if (!m_rootFrameViewport)
return;
- ScrollResult result = m_scroller->userScroll(granularity, remainingDelta);
+ ScrollResult result = m_rootFrameViewport->userScroll(granularity, remainingDelta);
// We consider top controls movement to be scrolling.
result.didScrollY |= topControlsConsumedScroll;
@@ -98,7 +102,8 @@ void RootViewportScrollCallback::handleEvent(ScrollState* state)
void RootViewportScrollCallback::setScroller(ScrollableArea* scroller)
{
- m_scroller = scroller;
+ DCHECK(scroller);
+ m_rootFrameViewport->setLayoutViewport(*scroller);
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698