summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp
diff options
context:
space:
mode:
authordtapuska <dtapuska@chromium.org>2016-03-18 09:30:03 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-18 16:31:25 +0000
commit577382823d241be3ba011b9713c817afdfd5a2c3 (patch)
treec585b0986e29f219824b8bea8da6a4d59f3a646e /third_party/WebKit/Source/platform/scroll/Scrollbar.cpp
parent210a55755d89d07f60f09645960bbf9dfd1d67b0 (diff)
downloadchromium_src-577382823d241be3ba011b9713c817afdfd5a2c3.zip
chromium_src-577382823d241be3ba011b9713c817afdfd5a2c3.tar.gz
chromium_src-577382823d241be3ba011b9713c817afdfd5a2c3.tar.bz2
Handle gesture scroll events on scrollbars from Touchpad.
With wheel gesture event generation wheel events inside scrollbars were not working correctly. The scrollbar was only entering the capturing phase on gesture tap down which doesn't occur with Touchpad. Transition capturing state on GestureScrollBegin when over a scrollbar. LayoutTest/fast/events/wheel-in-scrollbar.html LayoutTest covers testing this when wheel event gestures are enabled. BUG=568183 Review URL: https://codereview.chromium.org/1805063003 Cr-Commit-Position: refs/heads/master@{#381988}
Diffstat (limited to 'third_party/WebKit/Source/platform/scroll/Scrollbar.cpp')
-rw-r--r--third_party/WebKit/Source/platform/scroll/Scrollbar.cpp47
1 files changed, 41 insertions, 6 deletions
diff --git a/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp b/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp
index f1fa7bc..b340a59 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: