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

Unified Diff: third_party/WebKit/Source/platform/scroll/Scrollbar.cpp

Issue 1805063003: Handle gesture scroll events on scrollbars from Touchpad. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_wheel_regression_6
Patch Set: Add comment Created 4 years, 9 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 | « third_party/WebKit/Source/platform/scroll/Scrollbar.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/scroll/Scrollbar.cpp
diff --git a/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp b/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp
index f1fa7bc92c109843ae33199d7aa3b73c4bef4c0d..b340a59ad9af33bc6f118e92e25edce2588d0610 100644
--- a/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp
+++ b/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp
@@ -325,25 +325,60 @@ void Scrollbar::setPressedPart(ScrollbarPart part)
m_pressedPart = part;
}
-bool Scrollbar::gestureEvent(const PlatformGestureEvent& evt)
+bool Scrollbar::gestureEvent(const PlatformGestureEvent& evt, bool* shouldUpdateCapture)
{
+ DCHECK(shouldUpdateCapture);
switch (evt.type()) {
case PlatformEvent::GestureTapDown:
setPressedPart(theme().hitTest(*this, evt.position()));
m_pressedPos = orientation() == HorizontalScrollbar ? convertFromRootFrame(evt.position()).x() : convertFromRootFrame(evt.position()).y();
+ *shouldUpdateCapture = true;
return true;
case PlatformEvent::GestureTapDownCancel:
- case PlatformEvent::GestureScrollBegin:
if (m_pressedPart != ThumbPart)
return false;
m_scrollPos = m_pressedPos;
return true;
+ case PlatformEvent::GestureScrollBegin:
+ switch (evt.source()) {
+ case PlatformGestureSourceTouchpad:
+ // Update the state on GSB for touchpad since GestureTapDown
+ // is not generated by that device. Touchscreen uses the tap down
+ // gesture since the scrollbar enters a visual active state.
+ *shouldUpdateCapture = true;
+ setPressedPart(NoPart);
+ m_pressedPos = 0;
+ return true;
+ case PlatformGestureSourceTouchscreen:
+ if (m_pressedPart != ThumbPart)
+ return false;
+ m_scrollPos = m_pressedPos;
+ return true;
+ default:
+ ASSERT_NOT_REACHED();
+ return true;
+ }
+ break;
case PlatformEvent::GestureScrollUpdate:
- if (m_pressedPart != ThumbPart)
+ switch (evt.source()) {
+ case PlatformGestureSourceTouchpad: {
+ FloatSize delta(-evt.deltaX(), -evt.deltaY());
+ if (m_scrollableArea && m_scrollableArea->userScroll(evt.deltaUnits(), delta).didScroll()) {
+ return true;
+ }
return false;
- m_scrollPos += orientation() == HorizontalScrollbar ? evt.deltaX() : evt.deltaY();
- moveThumb(m_scrollPos, false);
- return true;
+ }
+ case PlatformGestureSourceTouchscreen:
+ if (m_pressedPart != ThumbPart)
+ return false;
+ m_scrollPos += orientation() == HorizontalScrollbar ? evt.deltaX() : evt.deltaY();
+ moveThumb(m_scrollPos, false);
+ return true;
+ default:
+ ASSERT_NOT_REACHED();
+ return true;
+ }
+ break;
case PlatformEvent::GestureScrollEnd:
case PlatformEvent::GestureLongPress:
case PlatformEvent::GestureFlingStart:
« no previous file with comments | « third_party/WebKit/Source/platform/scroll/Scrollbar.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698