* Needless group tab is not closed correctly when it is "to-be-reloaded".

* Group tab wrongly closed even if the last sibling has any child.
This commit is contained in:
Piro / SHIMODA Hiroshi 2011-07-30 03:07:37 +09:00
parent 0494e7a229
commit 327771a2b6
2 changed files with 25 additions and 13 deletions

View File

@ -2606,8 +2606,6 @@ TreeStyleTabBrowser.prototype = {
if (collapsed)
this.stopRendering();
this.closeNeedlessGroupTabSibling(tab);
var backupAttributes = {};
if (this.hasChildTabs(tab))
backupAttributes[this.kCHILDREN] = this.getTabValue(tab, this.kCHILDREN);
@ -2635,6 +2633,9 @@ TreeStyleTabBrowser.prototype = {
}
}
var toBeClosedSibling = !this.hasChildTabs(tab) ?
this._reserveCloseNeedlessGroupTabSibling(tab) : null ;
var firstChild = this.getFirstChildTab(tab);
var parentTab = this.getParentTab(tab);
var nextFocusedTab = null;
@ -2730,6 +2731,8 @@ TreeStyleTabBrowser.prototype = {
}
if (b.selectedTab == tab) {
if (nextFocusedTab && nextFocusedTab == toBeClosedSibling)
nextFocusedTab = this.getFirstChildTab(nextFocusedTab);
if (
nextFocusedTab &&
!nextFocusedTab.hidden
@ -2766,31 +2769,30 @@ TreeStyleTabBrowser.prototype = {
if (collapsed)
this.startRendering();
},
closeNeedlessGroupTabSibling : function TSTBrowser_closeNeedlessGroupTabSibling(aTab)
_reserveCloseNeedlessGroupTabSibling : function TSTBrowser_reserveCloseNeedlessGroupTabSibling(aTab)
{
if (!aTab)
return;
return null;
var parent = this.getParentTab(aTab);
var siblings = parent && parent.parentNode ? this.getChildTabs(parent) : this.visibleRootTabs ;
siblings = siblings.filter(function(aSiblingTab) {
return aSiblingTab != aTab;
});
var groupTabs = siblings.filter(function(aSiblingTab) {
return this.isGroupTab(aSiblingTab);
var siblings = this.getSiblingTabs(aTab);
var groupTabs = siblings.filter(function(aTab) {
return this.isGroupTab(aTab);
}, this);
var groupTab = (
groupTabs.length == 1 &&
siblings.length == 1 &&
this.hasChildTabs(groupTabs[0])
) ? groupTabs[0] : null ;
if (groupTab)
if (groupTab) {
this.window.setTimeout(function(aSelf, aGroupTab) {
aSelf.getTabBrowserFromChild(aGroupTab).removeTab(aGroupTab, { animate : true });
}, 0, this, groupTab);
return groupTab;
}
return null;
},
getNextFocusedTab : function TSTBrowser_getNextFocusedTab(aTab)
{

View File

@ -1978,6 +1978,16 @@ var TreeStyleTabUtils = {
).singleNodeValue;
},
getSiblingTabs : function TSTUtils_getSiblingTabs(aTab) /* PUBLIC API */
{
var parent = this.getParentTab(aTab);
var siblings = parent && parent.parentNode ? this.getChildTabs(parent) : this.visibleRootTabs ;
return siblings.filter(function(aSiblingTab) {
return aSiblingTab != aTab;
});
},
getChildTabs : function TSTUtils_getChildTabs(aTab, aAllTabsArray) /* PUBLIC API */
{
var tabs = [];