diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index d0235179..c946dc88 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -45,6 +45,7 @@ var TreeStyleTabService = { kACTION_STAY : 2, kACTION_DUPLICATE : 4, kACTION_IMPORT : 8, + kACTION_NEWTAB : 16, kACTION_ATTACH : 1024, kACTION_PART : 2048, kACTIONS_FOR_SOURCE : 1 | 2, diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index 87e3fb3c..cdce5092 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -1951,7 +1951,12 @@ TreeStyleTabBrowser.prototype = { canDrop : function(aEvent, aDragSession) { - return this.getDropAction(aEvent, aDragSession).canDrop; + var dropAction = this.getDropAction(aEvent, aDragSession); + if ('dataTransfer' in aEvent && dropAction.action & this.kACTION_NEWTAB) { + var dt = aEvent.dataTransfer; + dt.effectAllowed = dt.dropEffect = 'link'; + } + return dropAction.canDrop; }, getSupportedFlavours : function() @@ -2035,9 +2040,11 @@ TreeStyleTabBrowser.prototype = { }; var isTabMoveFromOtherWindow = aSourceTab && aSourceTab.ownerDocument != document; + var isNewTabAction = !aSourceTab || aSourceTab.ownerDocument != document; if (tab.localName != 'tab') { var action = isTabMoveFromOtherWindow ? this.kACTION_STAY : (this.kACTION_MOVE | this.kACTION_PART) ; + if (isNewTabAction) action |= this.kACTION_NEWTAB; if (aEvent[this.positionProp] < tabs[0].boxObject[this.positionProp]) { info.target = info.parent = info.insertBefore = tabs[0]; info.position = isInverted ? this.kDROP_AFTER : this.kDROP_BEFORE ; @@ -2133,6 +2140,8 @@ TreeStyleTabBrowser.prototype = { break; } + if (isNewTabAction) action |= this.kACTION_NEWTAB; + return info; },