Bug 1362065 - Add the touchdownstartsdrag attribute to selected tabs on Windows. r=dao draft
authorJohann Hofmann <jhofmann@mozilla.com>
Fri, 10 Nov 2017 12:06:50 +0100
changeset 696872 b4d616f45de4362d2fd505dacbf7176d12a04e37
parent 696262 864174ac0707207f7fc698ed6c3c47c043e99395
child 739950 2dac9b5341130868a3ac84b5dfd3a7b62d0dabf6
push id88813
push userbmo:jhofmann@mozilla.com
push dateSun, 12 Nov 2017 11:40:55 +0000
reviewersdao
bugs1362065
milestone58.0a1
Bug 1362065 - Add the touchdownstartsdrag attribute to selected tabs on Windows. r=dao This allows dragging them via touch gestures. I'm not adding this attribute to all tabs (so that you need to select a tab before dragging it), because the tab strip can also be scrolled with touch gestures and the two touch move actions would easily conflict otherwise. It would also make it easier to accidentally mess up your tabs when touching your window somehow. MozReview-Commit-ID: IVWQtVGFE9j
browser/base/content/tabbrowser.xml
browser/components/customizableui/CustomizeMode.jsm
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -1421,16 +1421,22 @@
               }
             }
 
             updateUserContextUIIndicator();
             gIdentityHandler.updateSharingIndicator();
 
             this.tabContainer._setPositionalAttributes();
 
+            // Enable touch events to start a native dragging
+            // session to allow the user to easily drag the selected tab.
+            // This is currently only supported on Windows.
+            oldTab.removeAttribute("touchdownstartsdrag");
+            this.mCurrentTab.setAttribute("touchdownstartsdrag", "true");
+
             if (!gMultiProcessBrowser) {
               document.commandDispatcher.unlock();
 
               let event = new CustomEvent("TabSwitchDone", {
                 bubbles: true,
                 cancelable: true
               });
               this.dispatchEvent(event);
--- a/browser/components/customizableui/CustomizeMode.jsm
+++ b/browser/components/customizableui/CustomizeMode.jsm
@@ -899,21 +899,19 @@ CustomizeMode.prototype = {
       } else if (wrapper.hasAttribute("haswideitem")) {
         wrapper.removeAttribute("haswideitem");
       }
     }
 
     let removable = aPlace == "palette" || CustomizableUI.isWidgetRemovable(aNode);
     wrapper.setAttribute("removable", removable);
 
-    if (AppConstants.platform == "win") {
-      // Allow touch events to initiate dragging in customize mode.
-      // This is only supported on Windows for now.
-      wrapper.setAttribute("touchdownstartsdrag", "true");
-    }
+    // Allow touch events to initiate dragging in customize mode.
+    // This is only supported on Windows for now.
+    wrapper.setAttribute("touchdownstartsdrag", "true");
 
     let contextMenuAttrName = "";
     if (aNode.getAttribute("context")) {
       contextMenuAttrName = "context";
     } else if (aNode.getAttribute("contextmenu")) {
       contextMenuAttrName = "contextmenu";
     }
     let currentContextMenu = aNode.getAttribute(contextMenuAttrName);