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
--- 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);