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

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

Issue 1557993002: Add scroll units in GestureEvents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 47861ee82accc725137fb84ebbac9b5d1eb3bf63..131ab4313a92302de30861c2ad0436439428fab7 100644
--- a/third_party/WebKit/Source/core/input/EventHandler.cpp
+++ b/third_party/WebKit/Source/core/input/EventHandler.cpp
@@ -2505,6 +2505,15 @@ WebInputEventResult EventHandler::handleGestureScrollUpdate(const PlatformGestur
if (delta.isZero())
return WebInputEventResult::NotHandled;
+ ScrollGranularity granularity = gestureEvent.deltaUnits();
+
+ if (granularity == ScrollByPage) {
+ if (delta.width())
+ delta.setWidth(delta.width() > 0 ? 1 : -1);
+ if (delta.height())
+ delta.setHeight(delta.height() > 0 ? 1 : -1);
tdresser 2016/01/05 16:07:33 If a mousewheel is set to scroll by page, and we c
tdresser 2016/01/05 16:27:32 I didn't realize this was already the case. Let's
dtapuska 2016/01/05 16:52:28 I'll move it to the time the gesture is generated;
dtapuska 2016/01/05 16:52:28 Acknowledged.
+ }
+
Node* node = m_scrollGestureHandlingNode.get();
if (node) {
LayoutObject* layoutObject = node->layoutObject();
@@ -2556,7 +2565,6 @@ WebInputEventResult EventHandler::handleGestureScrollUpdate(const PlatformGestur
stopNode = m_previousGestureScrolledNode.get();
// First try to scroll the closest scrollable LayoutBox ancestor of |node|.
- ScrollGranularity granularity = ScrollByPrecisePixel;
ScrollResultOneDimensional result = scroll(ScrollLeftIgnoringWritingMode, granularity, node, &stopNode, delta.width());
bool horizontalScroll = result.didScroll;
if (!gestureEvent.preventPropagation())
@@ -2580,7 +2588,7 @@ WebInputEventResult EventHandler::handleGestureScrollUpdate(const PlatformGestur
return WebInputEventResult::NotHandled;
// Try to scroll the frame view.
- ScrollResult scrollResult = m_frame->applyScrollDelta(delta, false);
+ ScrollResult scrollResult = m_frame->applyScrollDelta(granularity, delta, false);
FloatPoint position = FloatPoint(gestureEvent.position().x(), gestureEvent.position().y());
FloatSize velocity = FloatSize(gestureEvent.velocityX(), gestureEvent.velocityY());
handleOverscroll(scrollResult, position, velocity);

Powered by Google App Engine
This is Rietveld 408576698