Bug 1373714 - Support touch-dragging the scrollthumb in XUL tree widgets. r=dao draft
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 04 Jul 2017 09:57:45 -0400
changeset 603748 b429c96aa7af40b128434d31417a25bc90b5d030
parent 603265 283debe8155accfec5812c66e33384ce217d02c2
child 635985 1652eb58cf1b7dff4bb008e55d226fe5043ef752
push id66845
push userkgupta@mozilla.com
push dateTue, 04 Jul 2017 14:03:17 +0000
reviewersdao
bugs1373714
milestone56.0a1
Bug 1373714 - Support touch-dragging the scrollthumb in XUL tree widgets. r=dao MozReview-Commit-ID: Jcf3cXJvTJ2
toolkit/content/widgets/tree.xml
--- a/toolkit/content/widgets/tree.xml
+++ b/toolkit/content/widgets/tree.xml
@@ -680,22 +680,29 @@
           return this.changeOpenState(this.currentIndex);
         ]]></body>
       </method>
     </implementation>
 
     <handlers>
       <handler event="touchstart">
         <![CDATA[
-          if (event.touches.length > 1) {
+          function isScrollbarElement(target) {
+            return (target.localName == "thumb" || target.localName == "slider")
+                && target.namespaceURI == "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
+          }
+          if (event.touches.length > 1 || isScrollbarElement(event.touches[0].target)) {
             // Multiple touch points detected, abort. In particular this aborts
             // the panning gesture when the user puts a second finger down after
             // already panning with one finger. Aborting at this point prevents
             // the pan gesture from being resumed until all fingers are lifted
             // (as opposed to when the user is back down to one finger).
+            // Additionally, if the user lands on the scrollbar don't use this
+            // code for scrolling, instead allow gecko to handle scrollbar
+            // interaction normally.
             this._touchY = -1;
           } else {
             this._touchY = event.touches[0].screenY;
           }
         ]]>
       </handler>
       <handler event="touchmove">
         <![CDATA[