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

Unified Diff: third_party/WebKit/Source/core/input/EventHandler.cpp

Issue 1879103002: Convert main-thread overscroll parameters into viewport space. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Majid's review Created 4 years, 8 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/input/EventHandler.cpp
diff --git a/third_party/WebKit/Source/core/input/EventHandler.cpp b/third_party/WebKit/Source/core/input/EventHandler.cpp
index 0de628c3c4316a86eb5838de97713e79fee58ca7..fe9f85675d6574e6a3e4c70aa0fa6446cabeb509 100644
--- a/third_party/WebKit/Source/core/input/EventHandler.cpp
+++ b/third_party/WebKit/Source/core/input/EventHandler.cpp
@@ -2373,16 +2373,23 @@ static inline FloatSize adjustOverscroll(FloatSize unusedDelta)
return unusedDelta;
}
-void EventHandler::handleOverscroll(const ScrollResult& scrollResult, const FloatPoint& position, const FloatSize& velocity)
+void EventHandler::handleOverscroll(const ScrollResult& scrollResult, const FloatPoint& positionInRootFrame, const FloatSize& velocityInRootFrame)
{
ASSERT(m_frame->isMainFrame());
+ VisualViewport& visualViewport = m_frame->page()->frameHost().visualViewport();
FloatSize unusedDelta(scrollResult.unusedScrollDeltaX, scrollResult.unusedScrollDeltaY);
unusedDelta = adjustOverscroll(unusedDelta);
+
+ FloatSize deltaInViewport = unusedDelta.scaledBy(visualViewport.scale());
+ FloatSize velocityInViewport = velocityInRootFrame.scaledBy(visualViewport.scale());
+ FloatPoint positionInViewport =
+ visualViewport.rootFrameToViewport(positionInRootFrame);
+
resetOverscroll(scrollResult.didScrollX, scrollResult.didScrollY);
- if (unusedDelta != FloatSize()) {
- m_accumulatedRootOverscroll += unusedDelta;
- m_frame->chromeClient().didOverscroll(unusedDelta, m_accumulatedRootOverscroll, position, velocity);
+ if (deltaInViewport != FloatSize()) {
+ m_accumulatedRootOverscroll += deltaInViewport;
+ m_frame->chromeClient().didOverscroll(deltaInViewport, m_accumulatedRootOverscroll, positionInViewport, velocityInViewport);
}
}
@@ -2463,8 +2470,8 @@ WebInputEventResult EventHandler::handleGestureScrollUpdate(const PlatformGestur
m_previousGestureScrolledNode = stopNode;
if (m_frame->isMainFrame() && (!stopNode || stopNode->layoutObject() == m_frame->view()->layoutView())) {
- FloatPoint position = FloatPoint(gestureEvent.position().x(), gestureEvent.position().y());
- handleOverscroll(result, position, velocity);
+ FloatPoint positionInRootFrame = FloatPoint(gestureEvent.position().x(), gestureEvent.position().y());
+ handleOverscroll(result, positionInRootFrame, velocity);
} else {
resetOverscroll(result.didScrollX, result.didScrollY);
}
« no previous file with comments | « third_party/WebKit/Source/core/input/EventHandler.h ('k') | third_party/WebKit/Source/core/page/ChromeClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698