* 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:
parent
0494e7a229
commit
327771a2b6
@ -2606,8 +2606,6 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
if (collapsed)
|
if (collapsed)
|
||||||
this.stopRendering();
|
this.stopRendering();
|
||||||
|
|
||||||
this.closeNeedlessGroupTabSibling(tab);
|
|
||||||
|
|
||||||
var backupAttributes = {};
|
var backupAttributes = {};
|
||||||
if (this.hasChildTabs(tab))
|
if (this.hasChildTabs(tab))
|
||||||
backupAttributes[this.kCHILDREN] = this.getTabValue(tab, this.kCHILDREN);
|
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 firstChild = this.getFirstChildTab(tab);
|
||||||
var parentTab = this.getParentTab(tab);
|
var parentTab = this.getParentTab(tab);
|
||||||
var nextFocusedTab = null;
|
var nextFocusedTab = null;
|
||||||
@ -2730,6 +2731,8 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (b.selectedTab == tab) {
|
if (b.selectedTab == tab) {
|
||||||
|
if (nextFocusedTab && nextFocusedTab == toBeClosedSibling)
|
||||||
|
nextFocusedTab = this.getFirstChildTab(nextFocusedTab);
|
||||||
if (
|
if (
|
||||||
nextFocusedTab &&
|
nextFocusedTab &&
|
||||||
!nextFocusedTab.hidden
|
!nextFocusedTab.hidden
|
||||||
@ -2766,31 +2769,30 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
if (collapsed)
|
if (collapsed)
|
||||||
this.startRendering();
|
this.startRendering();
|
||||||
},
|
},
|
||||||
closeNeedlessGroupTabSibling : function TSTBrowser_closeNeedlessGroupTabSibling(aTab)
|
_reserveCloseNeedlessGroupTabSibling : function TSTBrowser_reserveCloseNeedlessGroupTabSibling(aTab)
|
||||||
{
|
{
|
||||||
if (!aTab)
|
if (!aTab)
|
||||||
return;
|
return null;
|
||||||
|
|
||||||
var parent = this.getParentTab(aTab);
|
var parent = this.getParentTab(aTab);
|
||||||
|
var siblings = this.getSiblingTabs(aTab);
|
||||||
var siblings = parent && parent.parentNode ? this.getChildTabs(parent) : this.visibleRootTabs ;
|
var groupTabs = siblings.filter(function(aTab) {
|
||||||
siblings = siblings.filter(function(aSiblingTab) {
|
return this.isGroupTab(aTab);
|
||||||
return aSiblingTab != aTab;
|
|
||||||
});
|
|
||||||
var groupTabs = siblings.filter(function(aSiblingTab) {
|
|
||||||
return this.isGroupTab(aSiblingTab);
|
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
var groupTab = (
|
var groupTab = (
|
||||||
groupTabs.length == 1 &&
|
groupTabs.length == 1 &&
|
||||||
siblings.length == 1 &&
|
siblings.length == 1 &&
|
||||||
this.hasChildTabs(groupTabs[0])
|
this.hasChildTabs(groupTabs[0])
|
||||||
) ? groupTabs[0] : null ;
|
) ? groupTabs[0] : null ;
|
||||||
|
|
||||||
if (groupTab)
|
if (groupTab) {
|
||||||
this.window.setTimeout(function(aSelf, aGroupTab) {
|
this.window.setTimeout(function(aSelf, aGroupTab) {
|
||||||
aSelf.getTabBrowserFromChild(aGroupTab).removeTab(aGroupTab, { animate : true });
|
aSelf.getTabBrowserFromChild(aGroupTab).removeTab(aGroupTab, { animate : true });
|
||||||
}, 0, this, groupTab);
|
}, 0, this, groupTab);
|
||||||
|
return groupTab;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
},
|
},
|
||||||
getNextFocusedTab : function TSTBrowser_getNextFocusedTab(aTab)
|
getNextFocusedTab : function TSTBrowser_getNextFocusedTab(aTab)
|
||||||
{
|
{
|
||||||
|
@ -1978,6 +1978,16 @@ var TreeStyleTabUtils = {
|
|||||||
).singleNodeValue;
|
).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 */
|
getChildTabs : function TSTUtils_getChildTabs(aTab, aAllTabsArray) /* PUBLIC API */
|
||||||
{
|
{
|
||||||
var tabs = [];
|
var tabs = [];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user