mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 06:35:42 +00:00
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:
parent
4a6e78a014
commit
2cc45c59f5
@ -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,14 +1324,19 @@ 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);
|
||||
} 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,7 +37,7 @@
|
||||
*
|
||||
* ***** 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);
|
||||
|
||||
@ -45,9 +45,8 @@ function createEmptyGroupItem(contentWindow, width, height, padding, noAnimation
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user