ブックマークフォルダから開かれたタブのグループの最後の子を閉じた時のフォーカス制御を改善

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4645 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2009-07-07 01:09:50 +00:00
parent 85e79a8671
commit da3b721180

View File

@ -1496,11 +1496,16 @@ TreeStyleTabBrowser.prototype = {
while (ancestor = this.getParentTab(ancestor)); while (ancestor = this.getParentTab(ancestor));
backupAttributes[this.kANCESTOR] = ancestors.join('|'); backupAttributes[this.kANCESTOR] = ancestors.join('|');
var shouldCloseParentTab = (
this.isGroupTab(parentTab) &&
this.getDescendantTabs(parentTab).length == 1
);
if (shouldCloseParentTab && nextFocusedTab == parentTab)
nextFocusedTab = this.getNextFocusedTab(parentTab);
this.partTab(tab, true); this.partTab(tab, true);
if (this.isGroupTab(parentTab) && !this.getDescendantTabs(parentTab).length) { if (shouldCloseParentTab) {
if (nextFocusedTab == parentTab)
nextFocusedTab = this.getNextSiblingTab(parentTab) || this.getPreviousSiblingTab(parentTab);
// when closing the last tab on Firefox 3.0 // when closing the last tab on Firefox 3.0
if (!this.getPref('browser.tabs.closeWindowWithLastTab') && if (!this.getPref('browser.tabs.closeWindowWithLastTab') &&
this.getTabs(b).snapshotLength == 2) this.getTabs(b).snapshotLength == 2)
@ -1509,7 +1514,7 @@ TreeStyleTabBrowser.prototype = {
} }
} }
else if (!nextFocusedTab) { else if (!nextFocusedTab) {
nextFocusedTab = this.getNextSiblingTab(tab) || this.getPreviousSiblingTab(tab); nextFocusedTab = this.getNextFocusedTab(tab);
} }
if ( if (
@ -1537,6 +1542,12 @@ TreeStyleTabBrowser.prototype = {
CLOSE_PARENT_BEHAVIOR_CLOSE : 2, CLOSE_PARENT_BEHAVIOR_CLOSE : 2,
CLOSE_ROOT_BEHAVIOR_ESCALATE_FIRST : 3, CLOSE_ROOT_BEHAVIOR_ESCALATE_FIRST : 3,
CLOSE_ROOT_BEHAVIOR_DETACH : 1, CLOSE_ROOT_BEHAVIOR_DETACH : 1,
getNextFocusedTab : function(aTab)
{
return this.getNextSiblingTab(aTab) ||
this.getPreviousSiblingTab(aTab) ||
this.getPreviousVisibleTab(aTab);
},
onTabMove : function(aEvent) onTabMove : function(aEvent)
{ {