diff --git a/content/treestyletab/res/tabsDragUtils.js b/content/treestyletab/res/tabsDragUtils.js index b9b28464..1b0d3b25 100644 --- a/content/treestyletab/res/tabsDragUtils.js +++ b/content/treestyletab/res/tabsDragUtils.js @@ -148,7 +148,9 @@ 'ancestor-or-self::*[local-name()="tabbrowser"] | '+ 'ancestor-or-self::*[local-name()="tabs" and @tabbrowser]', aTabBrowserChild, - XPathResult.FIRST_ORDERED_NODE_TYPE + null, + XPathResult.FIRST_ORDERED_NODE_TYPE, + null ).singleNodeValue; return (b && b.tabbrowser) || b; }, @@ -166,17 +168,17 @@ return true; }, - getSelectedTabs : function TDU_getSelectedTabs(aEvent) + getSelectedTabs : function TDU_getSelectedTabs(aEventOrTabBrowser) { - var b = this.getTabBrowserFromChild(aEvent.target); + var event = aEventOrTabBrowser instanceof Components.interfaces.nsIDOMEvent ? aEventOrTabBrowser : null ; + var b = this.getTabBrowserFromChild(event ? event.target : aEventOrTabBrowser ); var w = b.ownerDocument.defaultView; - var isMultipleDragEvent = this.isTabsDragging(aEvent); var selectedTabs; var isMultipleDrag = ( ( - isMultipleDragEvent && - (selectedTabs = this.getDraggedTabs(aEvent)) && + this.isTabsDragging(event) && + (selectedTabs = this.getDraggedTabs(event)) && selectedTabs.length ) || ( // Firefox 4.x (https://bugzilla.mozilla.org/show_bug.cgi?id=566510) diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index e7151511..74acf466 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -3671,13 +3671,15 @@ TreeStyleTabBrowser.prototype = { var targetBrowser = this.mTabBrowser; var tabs = this.getTabsArray(targetBrowser); - var draggedTabs = [aTab]; - var draggedRoots = [aTab]; - var sourceWindow = aTab.ownerDocument.defaultView; var sourceBrowser = this.getTabBrowserFromChild(aTab); - var draggedTabs = window['piro.sakura.ne.jp'].tabsDragUtils.getSelectedTabs(aInfo.event); + + var draggedTabs = window['piro.sakura.ne.jp'].tabsDragUtils.getSelectedTabs(aInfo.event || sourceBrowser); + var draggedRoots = [aTab]; + var isMultipleMove = false; + if (draggedTabs.length > 1) { + isMultipleMove = true; if (!(aInfo.action & this.kACTIONS_FOR_DESTINATION)) { draggedRoots = []; draggedTabs.forEach(function(aTab) { @@ -3695,7 +3697,7 @@ TreeStyleTabBrowser.prototype = { } } else if (aInfo.action & this.kACTIONS_FOR_DESTINATION) { - draggedTabs = draggedTabs.concat(sourceBrowser.treeStyleTab.getDescendantTabs(aTab)); + draggedTabs = [aTab].concat(sourceBrowser.treeStyleTab.getDescendantTabs(aTab)); } return {