Define handleNewTabFromCurrent and handleNewTabCommand as methods of both TSTWindow and TSTBrowser (for future changes to open related tab from the current tab from TSTBrowser)
This commit is contained in:
parent
5954e76c02
commit
f8b994eb26
@ -1667,6 +1667,39 @@ var TreeStyleTabBase = {
|
|||||||
var ownerBrowser = this.getTabBrowserFromFrame(frame);
|
var ownerBrowser = this.getTabBrowserFromFrame(frame);
|
||||||
return !!(ownerBrowser.treeStyleTab.readiedToAttachNewTab || ownerBrowser.treeStyleTab.readiedToAttachNewTabGroup);
|
return !!(ownerBrowser.treeStyleTab.readiedToAttachNewTab || ownerBrowser.treeStyleTab.readiedToAttachNewTabGroup);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
kNEWTAB_DO_NOTHING : -1,
|
||||||
|
kNEWTAB_OPEN_AS_ORPHAN : 0,
|
||||||
|
kNEWTAB_OPEN_AS_CHILD : 1,
|
||||||
|
kNEWTAB_OPEN_AS_SIBLING : 2,
|
||||||
|
kNEWTAB_OPEN_AS_NEXT_SIBLING : 3,
|
||||||
|
handleNewTabCommand : function utils_handleNewTabCommand(aBaseTab, aBehavior)
|
||||||
|
{
|
||||||
|
switch (aBehavior)
|
||||||
|
{
|
||||||
|
case this.kNEWTAB_OPEN_AS_ORPHAN:
|
||||||
|
case this.kNEWTAB_DO_NOTHING:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
case this.kNEWTAB_OPEN_AS_CHILD:
|
||||||
|
this.readyToOpenChildTabNow(aBaseTab);
|
||||||
|
break;
|
||||||
|
case this.kNEWTAB_OPEN_AS_SIBLING:
|
||||||
|
let (parentTab = this.getParentTab(aBaseTab)) {
|
||||||
|
if (parentTab)
|
||||||
|
this.readyToOpenChildTabNow(parentTab);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case this.kNEWTAB_OPEN_AS_NEXT_SIBLING:
|
||||||
|
this.readyToOpenNextSiblingTabNow(aBaseTab);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
handleNewTabFromCurrent : function utils_handleNewTabFromCurrent(aBaseTab)
|
||||||
|
{
|
||||||
|
this.handleNewTabCommand(aBaseTab, utils.getTreePref('autoAttach.fromCurrent'));
|
||||||
|
},
|
||||||
|
|
||||||
/* tree manipulations */
|
/* tree manipulations */
|
||||||
|
|
||||||
|
@ -1072,39 +1072,6 @@ TreeStyleTabWindow.prototype = {
|
|||||||
return this._shownPopups.length > 0;
|
return this._shownPopups.length > 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
kNEWTAB_DO_NOTHING : -1,
|
|
||||||
kNEWTAB_OPEN_AS_ORPHAN : 0,
|
|
||||||
kNEWTAB_OPEN_AS_CHILD : 1,
|
|
||||||
kNEWTAB_OPEN_AS_SIBLING : 2,
|
|
||||||
kNEWTAB_OPEN_AS_NEXT_SIBLING : 3,
|
|
||||||
_handleNewTabCommand : function TSTWindow_handleNewTabCommand(aBaseTab, aBehavior)
|
|
||||||
{
|
|
||||||
switch (aBehavior)
|
|
||||||
{
|
|
||||||
case this.kNEWTAB_OPEN_AS_ORPHAN:
|
|
||||||
case this.kNEWTAB_DO_NOTHING:
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
case this.kNEWTAB_OPEN_AS_CHILD:
|
|
||||||
this.readyToOpenChildTabNow(aBaseTab);
|
|
||||||
break;
|
|
||||||
case this.kNEWTAB_OPEN_AS_SIBLING:
|
|
||||||
let (parentTab = this.getParentTab(aBaseTab)) {
|
|
||||||
if (parentTab)
|
|
||||||
this.readyToOpenChildTabNow(parentTab);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case this.kNEWTAB_OPEN_AS_NEXT_SIBLING:
|
|
||||||
this.readyToOpenNextSiblingTabNow(aBaseTab);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
handleNewTabFromCurrent : function TSTWindow_handleNewTabFromCurrent(aBaseTab)
|
|
||||||
{
|
|
||||||
this._handleNewTabCommand(aBaseTab, utils.getTreePref('autoAttach.fromCurrent'));
|
|
||||||
},
|
|
||||||
|
|
||||||
onBeforeNewTabCommand : function TSTWindow_onBeforeNewTabCommand(aTabBrowser)
|
onBeforeNewTabCommand : function TSTWindow_onBeforeNewTabCommand(aTabBrowser)
|
||||||
{
|
{
|
||||||
var self = this.windowService || this;
|
var self = this.windowService || this;
|
||||||
@ -1112,7 +1079,7 @@ TreeStyleTabWindow.prototype = {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var b = aTabBrowser || this.browser;
|
var b = aTabBrowser || this.browser;
|
||||||
this._handleNewTabCommand(b.selectedTab, utils.getTreePref('autoAttach.newTabCommand'));
|
this.handleNewTabCommand(b.selectedTab, utils.getTreePref('autoAttach.newTabCommand'));
|
||||||
},
|
},
|
||||||
|
|
||||||
handleNewTabActionOnButton : function TSTWindow_handleNewTabActionOnButton(aEvent)
|
handleNewTabActionOnButton : function TSTWindow_handleNewTabActionOnButton(aEvent)
|
||||||
@ -1123,7 +1090,7 @@ TreeStyleTabWindow.prototype = {
|
|||||||
|
|
||||||
var newTabButton = this.getNewTabButtonFromEvent(aEvent);
|
var newTabButton = this.getNewTabButtonFromEvent(aEvent);
|
||||||
if (newTabButton) {
|
if (newTabButton) {
|
||||||
this._handleNewTabCommand(this.browser.selectedTab, utils.getTreePref('autoAttach.newTabButton'));
|
this.handleNewTabCommand(this.browser.selectedTab, utils.getTreePref('autoAttach.newTabButton'));
|
||||||
let self = this.windowService || this;
|
let self = this.windowService || this;
|
||||||
self._clickEventOnNewTabButtonHandled = true;
|
self._clickEventOnNewTabButtonHandled = true;
|
||||||
this.Deferred.next(function() {
|
this.Deferred.next(function() {
|
||||||
@ -1131,7 +1098,7 @@ TreeStyleTabWindow.prototype = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (aEvent.target.id == 'urlbar-go-button' || aEvent.target.id == 'go-button') {
|
else if (aEvent.target.id == 'urlbar-go-button' || aEvent.target.id == 'go-button') {
|
||||||
this._handleNewTabCommand(this.browser.selectedTab, utils.getTreePref('autoAttach.goButton'));
|
this.handleNewTabCommand(this.browser.selectedTab, utils.getTreePref('autoAttach.goButton'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_clickEventOnNewTabButtonHandled : false,
|
_clickEventOnNewTabButtonHandled : false,
|
||||||
@ -1146,7 +1113,7 @@ TreeStyleTabWindow.prototype = {
|
|||||||
aDelta < 0 ? 'autoAttach.duplicateTabCommand.back' :
|
aDelta < 0 ? 'autoAttach.duplicateTabCommand.back' :
|
||||||
'autoAttach.duplicateTabCommand.forward'
|
'autoAttach.duplicateTabCommand.forward'
|
||||||
var behavior = utils.getTreePref(behaviorPref);
|
var behavior = utils.getTreePref(behaviorPref);
|
||||||
this._handleNewTabCommand(aTab || b.selectedTab, behavior);
|
this.handleNewTabCommand(aTab || b.selectedTab, behavior);
|
||||||
},
|
},
|
||||||
|
|
||||||
onBeforeOpenLink : function TSTWindow_onBeforeOpenLink(aWhere, aOwner)
|
onBeforeOpenLink : function TSTWindow_onBeforeOpenLink(aWhere, aOwner)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user