Bug 685456 - Don't freeze tabItem size when the tab wasn't closed by a mouse click; r=dietrich

This commit is contained in:
Tim Taubert 2011-09-27 04:33:37 +02:00
Родитель 021b726b4b
Коммит 9bb319a198
4 изменённых файлов: 10 добавлений и 5 удалений

Просмотреть файл

@ -1086,7 +1086,8 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
// tabItem - The tabItem that is closed.
_onChildClose: function GroupItem__onChildClose(tabItem) {
let count = this._children.length;
let dontArrange = this.expanded || !this.shouldStack(count);
let dontArrange = tabItem.closedManually &&
(this.expanded || !this.shouldStack(count));
let dontClose = !tabItem.closedManually && gBrowser._numPinnedTabs > 0;
this.remove(tabItem, {dontArrange: dontArrange, dontClose: dontClose});

Просмотреть файл

@ -18,12 +18,16 @@ function test() {
finish();
}
let closeTabItemManually = function (tabItem) {
EventUtils.synthesizeMouseAtCenter(tabItem.container, {button: 1}, cw);
}
let prepareTest = function (testName) {
let originalBounds = groupItem.getChild(0).getBounds();
let tabItem = groupItem.getChild(1);
let bounds = tabItem.getBounds();
tabItem.close();
closeTabItemManually(tabItem);
ok(originalBounds.equals(groupItem.getChild(0).getBounds()), testName + ': tabs did not change their size');
ok(bounds.equals(groupItem.getChild(1).getBounds()), testName + ': third tab is now on second tab\'s previous position');
@ -180,7 +184,7 @@ function test() {
let bounds = tabItem.getBounds();
while (groupItem.getChildren().length > 2)
groupItem.getChild(1).close();
closeTabItemManually(groupItem.getChild(1));
ok(originalBounds.equals(groupItem.getChild(0).getBounds()), 'testExpandedMode: tabs did not change their size');

Просмотреть файл

@ -27,7 +27,7 @@ function test() {
// remove two tabs and see if the remaining tabs are re-arranged to fill
// the resulting gaps
for (let i = 0; i < 2; i++) {
children[1].close();
EventUtils.synthesizeMouseAtCenter(children[1].container, {button: 1}, cw);
ok(bounds.equals(children[1].getBounds()), "tabItems were re-arranged");
}

Просмотреть файл

@ -21,7 +21,7 @@ function test() {
let bounds = tabItem.getBounds();
is(groupItem.getActiveTab(), tabItem, "the first tab is active");
tabItem.close();
EventUtils.synthesizeMouseAtCenter(tabItem.container, {button: 1}, cw);
is(groupItem.getChildren().indexOf(tabItem), -1, "tabItem got removed");
ok(bounds.equals(groupItem.getChild(0).getBounds()), "tabItem bounds didn't change");