| Index: Source/core/input/EventHandler.cpp
|
| diff --git a/Source/core/input/EventHandler.cpp b/Source/core/input/EventHandler.cpp
|
| index ed72ddf7134747ec0f7302532c2da5e16c164a68..78c49deb7214528211a84c585d6b427e5df5d1e6 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()->elasticOverscrollEnabled())
|
| + handleOverscroll(scrollResult);
|
| + if (scrollResult.didScroll())
|
| RETURN_WHEEL_EVENT_HANDLED();
|
|
|
| return false;
|
| @@ -2255,17 +2258,23 @@ 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);
|
| + FloatSize unusedDelta;
|
| + if (m_frame->settings() && m_frame->settings()->elasticOverscrollEnabled()) {
|
| + // ElasticOverscroll should be applied on non-Scrollable axis.
|
| + unusedDelta.setWidth(scrollResult.unusedScrollDeltaX);
|
| + unusedDelta.setHeight(scrollResult.unusedScrollDeltaY);
|
| + } else {
|
| + // In Case of android set unusedDelta if axis is scrollable, else set 0 to ensure overflow is not reported on non-scrollable axes.
|
| + unusedDelta.setWidth(scrollablearea->scrollSize(HorizontalScrollbar) ? scrollResult.unusedScrollDeltaX : 0);
|
| + unusedDelta.setHeight(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);
|
| }
|
| }
|
| @@ -2354,7 +2363,9 @@ 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());
|
| + handleOverscroll(scrollResult, position, velocity);
|
| if (scrollResult.didScroll()) {
|
| setFrameWasScrolledByUser();
|
| return true;
|
|
|