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

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: Rebase + comment fix in test 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
« no previous file with comments | « third_party/WebKit/Source/core/page/scrolling/RootViewportScrollCallback.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a75ebc3a0c280ad08012e8461212c700d4233ec3..d1a5206f8a34fc08a2be5343584dfe074d953e1e 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
@@ -77,12 +81,12 @@ bool RootViewportScrollCallback::scrollTopControls(ScrollState& state)
void RootViewportScrollCallback::handleEvent(ScrollState* state)
{
DCHECK(state);
- if (!m_scroller)
+ if (!m_rootFrameViewport)
return;
bool topControlsDidScroll = scrollTopControls(*state);
- ScrollResult result = performNativeScroll(*state, *m_scroller);
+ ScrollResult result = performNativeScroll(*state, *m_rootFrameViewport);
// We consider top controls movement to be scrolling.
result.didScrollY |= topControlsDidScroll;
@@ -97,7 +101,8 @@ void RootViewportScrollCallback::handleEvent(ScrollState* state)
void RootViewportScrollCallback::setScroller(ScrollableArea* scroller)
{
- m_scroller = scroller;
+ DCHECK(scroller);
+ m_rootFrameViewport->setLayoutViewport(*scroller);
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/page/scrolling/RootViewportScrollCallback.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698