Bug 1367765 - Do not scroll-to-click on touchstart if touch point is over thumb. r=rhunt
authorBotond Ballo <botond@mozilla.com>
Wed, 06 Sep 2017 19:14:39 -0400
changeset 430099 21e6767af2852d98ac4b6082b34f3f642aeb7699
parent 430098 a90f4d33dc80e1209492a3183da9d9a52935628b
child 430100 ba1cf2c8ad66501e2f03f03e3f3c4aa8d283e900
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrhunt
bugs1367765
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1367765 - Do not scroll-to-click on touchstart if touch point is over thumb. r=rhunt This matches the behaviour of mouse events over a scroll thumb. MozReview-Commit-ID: ArLzC6JXfos
layout/xul/nsSliderFrame.cpp
--- a/layout/xul/nsSliderFrame.cpp
+++ b/layout/xul/nsSliderFrame.cpp
@@ -1338,31 +1338,31 @@ nsSliderFrame::ShouldScrollForEvent(Widg
 
 bool
 nsSliderFrame::ShouldScrollToClickForEvent(WidgetGUIEvent* aEvent)
 {
   if (!ShouldScrollForEvent(aEvent)) {
     return false;
   }
 
-  if (aEvent->mMessage == eTouchStart) {
-    return GetScrollToClick();
-  }
-
-  if (aEvent->mMessage != eMouseDown) {
+  if (aEvent->mMessage != eMouseDown && aEvent->mMessage != eTouchStart) {
     return false;
   }
 
 #if defined(XP_MACOSX) || defined(MOZ_WIDGET_GTK)
   // On Mac and Linux, clicking the scrollbar thumb should never scroll to click.
   if (IsEventOverThumb(aEvent)) {
     return false;
   }
 #endif
 
+  if (aEvent->mMessage == eTouchStart) {
+    return GetScrollToClick();
+  }
+
   WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
   if (mouseEvent->button == WidgetMouseEvent::eLeftButton) {
 #ifdef XP_MACOSX
     bool invertPref = mouseEvent->IsAlt();
 #else
     bool invertPref = mouseEvent->IsShift();
 #endif
     return GetScrollToClick() != invertPref;