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

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

Issue 1195803003: Report accurate Overscroll on handleWheel. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fixed unittest failures Created 5 years, 6 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 | « Source/core/input/EventHandler.h ('k') | Source/platform/scroll/ScrollAnimator.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/input/EventHandler.cpp
diff --git a/Source/core/input/EventHandler.cpp b/Source/core/input/EventHandler.cpp
index ef85ea06c88dc30d293de1ace6dffd172b79b176..42241f0ce4fd2538b187b1d2f5896b71a715e7dd 100644
--- a/Source/core/input/EventHandler.cpp
+++ b/Source/core/input/EventHandler.cpp
@@ -1782,7 +1782,10 @@ bool EventHandler::handleWheelEvent(const PlatformWheelEvent& event)
if (!view)
return false;
- if (view->scrollableArea()->handleWheel(event).didScroll())
+ ScrollResult scrollResult = view->scrollableArea()->handleWheel(event);
+ if (m_frame->settings() && m_frame->settings()->reportWheelOverscroll())
+ handleOverscroll(scrollResult);
+ if (scrollResult.didScroll())
RETURN_WHEEL_EVENT_HANDLED();
return false;
@@ -2255,19 +2258,13 @@ void EventHandler::resetOverscroll(bool didScrollX, bool didScrollY)
m_accumulatedRootOverscroll.setHeight(0);
}
-void EventHandler::handleOverscroll(const ScrollResult& scrollResult, const PlatformGestureEvent& gestureEvent)
+void EventHandler::handleOverscroll(const ScrollResult& scrollResult, const FloatPoint& position, const FloatSize& velocity)
{
- if (m_frame->isMainFrame() && m_frame->view() && m_frame->view()->scrollableArea()) {
- ScrollableArea* scrollablearea = m_frame->view()->scrollableArea();
- // Set unusedDelta if axis is scrollable, else set 0 to ensure overflow is not reported on non-scrollable axes.
- FloatSize unusedDelta(scrollablearea->scrollSize(HorizontalScrollbar) ? scrollResult.unusedScrollDeltaX : 0, scrollablearea->scrollSize(VerticalScrollbar) ? scrollResult.unusedScrollDeltaY : 0);
- resetOverscroll(scrollResult.didScrollX, scrollResult.didScrollY);
- if (unusedDelta != FloatSize()) {
- m_accumulatedRootOverscroll += unusedDelta;
- FloatPoint position = FloatPoint(gestureEvent.position().x(), gestureEvent.position().y());
- FloatSize velocity = FloatSize(gestureEvent.velocityX(), gestureEvent.velocityY());
- m_frame->chromeClient().didOverscroll(unusedDelta, m_accumulatedRootOverscroll, position, velocity);
- }
+ FloatSize unusedDelta(scrollResult.unusedScrollDeltaX, scrollResult.unusedScrollDeltaY);
+ resetOverscroll(scrollResult.didScrollX, scrollResult.didScrollY);
+ if (unusedDelta != FloatSize()) {
+ m_accumulatedRootOverscroll += unusedDelta;
+ m_frame->chromeClient().didOverscroll(unusedDelta, m_accumulatedRootOverscroll, position, velocity);
}
}
@@ -2354,7 +2351,16 @@ bool EventHandler::handleGestureScrollUpdate(const PlatformGestureEvent& gesture
// Try to scroll the frame view.
ScrollResult scrollResult = m_frame->applyScrollDelta(delta, false);
- handleOverscroll(scrollResult, gestureEvent);
+ FloatPoint position = FloatPoint(gestureEvent.position().x(), gestureEvent.position().y());
+ FloatSize velocity = FloatSize(gestureEvent.velocityX(), gestureEvent.velocityY());
+ if (m_frame->isMainFrame() && m_frame->view() && m_frame->view()->scrollableArea()) {
+ ScrollableArea* scrollablearea = m_frame->view()->scrollableArea();
+ // TODO(sataya.m) : In Case of android set unusedDelta to 0 to ensure overflow is not reported
+ // on non-scrollable axis. Move this check to CC to block OverscrollGlow Animation on non-scrollable axes.
+ scrollResult.unusedScrollDeltaX = scrollablearea->scrollSize(HorizontalScrollbar) ? scrollResult.unusedScrollDeltaX : 0;
+ scrollResult.unusedScrollDeltaY = scrollablearea->scrollSize(VerticalScrollbar) ? scrollResult.unusedScrollDeltaY : 0;
+ }
+ handleOverscroll(scrollResult, position, velocity);
if (scrollResult.didScroll()) {
setFrameWasScrolledByUser();
return true;
« no previous file with comments | « Source/core/input/EventHandler.h ('k') | Source/platform/scroll/ScrollAnimator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698