Bug 634085 - Stacks do not show last-visited tab in the front for children after number 6 [r=ian, a=beltzner]

This commit is contained in:
Tim Taubert 2011-02-17 21:37:32 +01:00
Родитель 4a6e78a014
Коммит 2cc45c59f5
7 изменённых файлов: 66 добавлений и 13 удалений

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

@ -1316,7 +1316,6 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
{hideTitle:true});
}
// x is the left margin that the stack will have, within the content area (bb)
// y is the vertical margin
var x = (bb.width - size.x) / 2;
@ -1325,15 +1324,20 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
var self = this;
var children = [];
// ensure this.topChild is the first item in childrenToArrange
let topChildPos = childrenToArrange.indexOf(this.topChild);
if (topChildPos > 0) {
childrenToArrange.splice(topChildPos, 1);
childrenToArrange.unshift(this.topChild);
}
childrenToArrange.forEach(function GroupItem__stackArrange_order(child) {
// Children are still considered stacked even if they're hidden later.
child.addClass("stacked");
child.isStacked = true;
if (numInPile-- > 0) {
if (child == self.topChild)
children.unshift(child);
else
children.push(child);
children.push(child);
} else {
child.setHidden(true);
}

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

@ -114,6 +114,7 @@ _BROWSER_FILES = \
browser_tabview_bug630157.js \
browser_tabview_bug631662.js \
browser_tabview_bug634077.js \
browser_tabview_bug634085.js \
browser_tabview_bug634158.js \
browser_tabview_dragdrop.js \
browser_tabview_exit_button.js \

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

@ -54,7 +54,7 @@ function setup() {
is(groupItemOne.getChildren().length, 2, "Group one has 2 tab items");
// create group two with a blank tab.
let groupItemTwo = createEmptyGroupItem(contentWindow, 250, 250, 40, true);
let groupItemTwo = createEmptyGroupItem(contentWindow, 250, 250, 40);
createNewTabItemInGroupItem(groupItemTwo, contentWindow, function() {
// start the first test.
testGroups(groupItemOne, groupItemTwo, contentWindow);

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

@ -0,0 +1,49 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
let numChildren = 7;
let assertTopOfStack = function (tabItem) {
ok(!tabItem.getHidden(), "tabItem is visible");
is(tabItem.zIndex, tabItem.parent.getZ() + numChildren + 1, "zIndex");
}
let testTopOfStack = function (tabItem, callback) {
hideTabView(function () {
gBrowser.selectedTab = tabItem.tab;
showTabView(function () {
assertTopOfStack(tabItem);
callback();
});
});
}
let finishTest = function () {
registerCleanupFunction(function () {
is(1, gBrowser.tabs.length, "there is one tab, only");
ok(!TabView.isVisible(), "tabview is not visible");
});
finish();
}
waitForExplicitFinish();
showTabView(function () {
let groupItem = createGroupItemWithBlankTabs(window, 150, 150, 10, numChildren);
registerCleanupFunction(function () {
closeGroupItem(groupItem, function () TabView.hide());
});
testTopOfStack(groupItem.getChild(1), function () {
testTopOfStack(groupItem.getChild(6), function () {
closeGroupItem(groupItem, function () {
hideTabView(finishTest);
});
});
});
});
}

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

@ -65,7 +65,7 @@ function testEmptyGroupItem(contentWindow) {
let groupItemCount = contentWindow.GroupItems.groupItems.length;
// create empty group item
let emptyGroupItem = createEmptyGroupItem(contentWindow, 300, 300, 100, true);
let emptyGroupItem = createEmptyGroupItem(contentWindow, 300, 300, 100);
ok(emptyGroupItem.isEmpty(), "This group is empty");
is(contentWindow.GroupItems.groupItems.length, ++groupItemCount,
@ -89,7 +89,7 @@ function testEmptyGroupItem(contentWindow) {
}
function testGroupItemWithTabItem(contentWindow) {
let groupItem = createEmptyGroupItem(contentWindow, 300, 300, 200, true);
let groupItem = createEmptyGroupItem(contentWindow, 300, 300, 200);
let tabItemCount = 0;
let onTabViewHidden = function() {

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

@ -73,7 +73,7 @@ function testEmptyGroupItem(contentWindow) {
//
// create empty group item
let emptyGroupItem = createEmptyGroupItem(contentWindow, 253, 335, 100, true);
let emptyGroupItem = createEmptyGroupItem(contentWindow, 253, 335, 100);
ok(emptyGroupItem.isEmpty(), "This group is empty");
is(contentWindow.GroupItems.groupItems.length, ++groupItemCount,

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

@ -37,17 +37,16 @@
*
* ***** END LICENSE BLOCK ***** */
function createEmptyGroupItem(contentWindow, width, height, padding, noAnimation) {
function createEmptyGroupItem(contentWindow, width, height, padding, animate) {
let pageBounds = contentWindow.Items.getPageBounds();
pageBounds.inset(padding, padding);
let box = new contentWindow.Rect(pageBounds);
box.width = width;
box.height = height;
let immediately = noAnimation ? true: false;
let emptyGroupItem =
new contentWindow.GroupItem([], { bounds: box, immediately: immediately });
new contentWindow.GroupItem([], { bounds: box, immediately: !animate });
return emptyGroupItem;
}