Chromium Code Reviews| 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..64e6004a88deef52614bcdb6a89ce4bb36f9f8e2 100644 |
| --- a/third_party/WebKit/Source/core/input/EventHandler.cpp |
| +++ b/third_party/WebKit/Source/core/input/EventHandler.cpp |
| @@ -2373,16 +2373,26 @@ 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& velocity) |
|
majidvp
2016/04/13 18:20:38
s/velocity/velocityInRootFram/
bokan
2016/04/13 19:43:49
Done.
|
| { |
| ASSERT(m_frame->isMainFrame()); |
| + VisualViewport& visualViewport = m_frame->page()->frameHost().visualViewport(); |
| FloatSize unusedDelta(scrollResult.unusedScrollDeltaX, scrollResult.unusedScrollDeltaY); |
| unusedDelta = adjustOverscroll(unusedDelta); |
| + |
| + // The incoming event had its delta, position, and velocity transformed by |
| + // the visual viewport transform so when we pass it back we should undo it |
| + // to go back to viewport space. |
|
majidvp
2016/04/13 18:20:38
Can we simplify this comment by referencing from->
bokan
2016/04/13 19:43:49
Looking at this again, this comment isn't adding m
|
| + FloatSize deltaInViewport = unusedDelta.scaledBy(visualViewport.scale()); |
| + FloatSize velocityInViewport = velocity.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 +2473,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); |
| } |