Bug 1367765 - Do not scroll-to-click on touchstart if touch point is over thumb. r=rhunt draft
authorBotond Ballo <botond@mozilla.com>
Wed, 06 Sep 2017 19:14:39 -0400
changeset 663398 96f83e6b312dabd3c5573d73c1ce3f01e53055e5
parent 663397 e89fe4eefe615d3f65d2471ff59aa9d51d9ae5e2
child 663399 57c27ef5840d4932e28cda2eb2f6e921ccd11a71
push id79426
push userbballo@mozilla.com
push dateTue, 12 Sep 2017 23:39:18 +0000
reviewersrhunt
bugs1367765
milestone57.0a1
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;