Bug 1373714 - Support touch-dragging the scrollthumb in XUL tree widgets. r=dao a=jcristau
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 04 Jul 2017 09:57:45 -0400
changeset 606033 b8f32d3d5d85d3e81007bfa674d9c4b0e77b162e
parent 606032 c9ac0a66ff42c3898f3c6c3f9333b855a0f8363c
child 606034 3d31624e0a5b28abf6f3675e4ea006b0ee0aa2cf
push id67578
push userbmo:cam@mcc.id.au
push dateMon, 10 Jul 2017 07:09:36 +0000
reviewersdao, jcristau
bugs1373714
milestone55.0
Bug 1373714 - Support touch-dragging the scrollthumb in XUL tree widgets. r=dao a=jcristau 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[