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

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: Fix layout test on Mac Created 4 years, 11 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..038faa35d7cfaa1d7f062fe119ffeda61e22efb2 100644
--- a/third_party/WebKit/Source/core/input/EventHandler.cpp
+++ b/third_party/WebKit/Source/core/input/EventHandler.cpp
@@ -2505,7 +2505,11 @@ WebInputEventResult EventHandler::handleGestureScrollUpdate(const PlatformGestur
if (delta.isZero())
return WebInputEventResult::NotHandled;
+ ScrollGranularity granularity = gestureEvent.deltaUnits();
Node* node = m_scrollGestureHandlingNode.get();
+
+ // Scroll customization is only available for touch.
+ bool handleScrollCustomization = RuntimeEnabledFeatures::scrollCustomizationEnabled() && gestureEvent.source() == PlatformGestureSourceTouchscreen;
if (node) {
LayoutObject* layoutObject = node->layoutObject();
if (!layoutObject)
@@ -2531,7 +2535,7 @@ WebInputEventResult EventHandler::handleGestureScrollUpdate(const PlatformGestur
}
bool scrolled = false;
- if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) {
+ if (handleScrollCustomization) {
RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create(
gestureEvent.deltaX(), gestureEvent.deltaY(),
0, gestureEvent.velocityX(), gestureEvent.velocityY(),
@@ -2556,7 +2560,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())
@@ -2576,11 +2579,11 @@ WebInputEventResult EventHandler::handleGestureScrollUpdate(const PlatformGestur
}
}
- if (RuntimeEnabledFeatures::scrollCustomizationEnabled())
+ if (handleScrollCustomization)
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);
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalFrame.cpp ('k') | third_party/WebKit/Source/platform/PlatformGestureEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698