Bug 1362065 - Add the touchdownstartsdrag attribute to selected tabs on Windows. r=dao a=gchang
authorJohann Hofmann <jhofmann@mozilla.com>
Fri, 10 Nov 2017 12:06:50 +0100
changeset 704425 fbfb9e53d29e4576c1b6ca999ba61eab85ba4f2e
parent 704424 1e803860c220fdb0a1eabaafc23eeca5bf17313d
child 704426 1d9dd73c061c4192f7c3741eb05f35f8c464f2bb
push id91167
push userbmo:csadilek@mozilla.com
push dateTue, 28 Nov 2017 16:21:38 +0000
reviewersdao, gchang
bugs1362065
milestone58.0
Bug 1362065 - Add the touchdownstartsdrag attribute to selected tabs on Windows. r=dao a=gchang 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);