Bug 1450099 - Only enter the SCROLLBAR_DRAG state if the scrollbar thumb is clicked. r=kats
authorBotond Ballo <botond@mozilla.com>
Wed, 04 Apr 2018 16:29:57 -0400
changeset 777794 2dc5471ebd4a119941db86cbec9ed7d413b9a851
parent 777793 16bec207dc418bac3bef71ae5c15ade76032d6e0
child 777795 b8847ae94ccf9e30af925ac10054c3416a1db9ed
push id105296
push userpaolo.mozmail@amadzone.org
push dateThu, 05 Apr 2018 10:49:16 +0000
reviewerskats
bugs1450099
milestone61.0a1
Bug 1450099 - Only enter the SCROLLBAR_DRAG state if the scrollbar thumb is clicked. r=kats MozReview-Commit-ID: HkNvYQP0KqC
gfx/layers/apz/src/AsyncPanZoomController.cpp
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -956,35 +956,36 @@ nsEventStatus AsyncPanZoomController::Ha
   if (!gfxPrefs::APZDragEnabled()) {
     return nsEventStatus_eIgnore;
   }
 
   if (!GetApzcTreeManager()) {
     return nsEventStatus_eConsumeNoDefault;
   }
 
-  if (aEvent.mType == MouseInput::MouseType::MOUSE_DOWN) {
-    SetState(SCROLLBAR_DRAG);
-  }
-
   if (aEvent.mType == MouseInput::MouseType::MOUSE_UP) {
     SetState(NOTHING);
     ScrollSnap();
-  }
-
-  if (aEvent.mType != MouseInput::MouseType::MOUSE_MOVE) {
     return nsEventStatus_eConsumeNoDefault;
   }
 
   RefPtr<HitTestingTreeNode> node =
     GetApzcTreeManager()->FindScrollThumbNode(aDragMetrics);
   if (!node) {
     return nsEventStatus_eConsumeNoDefault;
   }
 
+  if (aEvent.mType == MouseInput::MouseType::MOUSE_DOWN) {
+    SetState(SCROLLBAR_DRAG);
+  }
+
+  if (aEvent.mType != MouseInput::MouseType::MOUSE_MOVE) {
+    return nsEventStatus_eConsumeNoDefault;
+  }
+
   const ScrollThumbData& thumbData = node->GetScrollThumbData();
   MOZ_ASSERT(thumbData.mDirection.isSome());
   ScrollDirection direction = *thumbData.mDirection;
 
   bool isMouseAwayFromThumb = false;
   if (int snapMultiplier = gfxPrefs::SliderSnapMultiplier()) {
     // It's fine to ignore the async component of the thumb's transform,
     // because any async transform of the thumb will be in the direction of