Bug 567391 + 575851: If we enter an orphan tab, only that tab should show up in the tab bar.

This commit is contained in:
Michael Yoshitaka Erlewine 2010-08-08 21:49:43 -04:00
parent f59d44241d
commit 18ca5dc914
5 changed files with 36 additions and 23 deletions

View File

@ -76,7 +76,7 @@ var Drag = function(item, event, isResizing, isFauxDrag) {
this.item.isDragging = true;
this.item.setZ(999999);
this.safeWindowBounds = Items.getSafeWindowBounds();
this.safeWindowBounds = Items.getSafeWindowBounds();
Trenches.activateOthersTrenches(this.el);

View File

@ -1676,8 +1676,16 @@ window.GroupItems = {
if (!window.UI)
return; // called too soon
let tabItems = this._activeGroupItem == null ? this.getOrphanedTabs() :
this._activeGroupItem._children;
// Utils.log('updateTabBar', this._activeGroupItem, this._activeOrphanTab);
if (!this._activeGroupItem && !this._activeOrphanTab) {
Utils.assert("There must be something to show in the tab bar!",
false);
return;
}
let tabItems = this._activeGroupItem == null ?
[this._activeOrphanTab] : this._activeGroupItem._children;
gBrowser.showOnlyTheseTabs(tabItems.map(function(item) item.tab));
},

View File

@ -176,8 +176,8 @@ window.Item.prototype = {
this.dragOptions = {
cancelClass: 'close stackExpander',
start: function(e, ui) {
if (this.isAGroupItem)
GroupItems.setActiveGroupItem(this);
if (this.isAGroupItem)
GroupItems.setActiveGroupItem(this);
drag.info = new Drag(this, e);
},
drag: function(e, ui) {
@ -218,8 +218,8 @@ window.Item.prototype = {
minWidth: 90,
minHeight: 90,
start: function(e,ui) {
if (this.isAGroupItem)
GroupItems.setActiveGroupItem(this);
if (this.isAGroupItem)
GroupItems.setActiveGroupItem(this);
resizeInfo = new Drag(this, e, true); // true = isResizing
},
resize: function(e,ui) {
@ -872,7 +872,7 @@ window.Items = {
// extra chrome which makes a large top gutter unnecessary.
// TODO: set top gutter separately, elsewhere.
var topGutter = 5;
return new Rect(gutter, topGutter,
return new Rect(gutter, topGutter,
window.innerWidth - 2 * gutter, window.innerHeight - gutter - topGutter);
},

View File

@ -438,8 +438,8 @@ window.TabItem.prototype = Utils.extend(new Item(), new Subscribable(), {
var b = this.getBounds();
var $title = iQ(this.container).find('.tab-title');
var height = b.height;
if ( $title.length )
height += parseInt($title.height());
if ( Utils.isNumber($title.height()) )
height += $title.height();
return new Rect(b.left, b.top, b.width, height);
},
@ -566,12 +566,12 @@ window.TabItem.prototype = Utils.extend(new Item(), new Subscribable(), {
var gID = self.parent.id;
var groupItem = GroupItems.groupItem(gID);
GroupItems.setActiveGroupItem(groupItem);
GroupItems.updateTabBarForActiveGroupItem();
GroupItems.updateTabBarForActiveGroupItem();
groupItem.setActiveTab(self);
} else {
GroupItems.setActiveGroupItem(null);
GroupItems.setActiveOrphanTab(self);
GroupItems.updateTabBarForActiveGroupItem();
GroupItems.updateTabBarForActiveGroupItem();
}
if (childHitResult.callback)
@ -630,7 +630,7 @@ window.TabItem.prototype = Utils.extend(new Item(), new Subscribable(), {
complete: function() { // note that this will happen on the DOM thread
$tab.removeClass('front');
GroupItems.setActiveOrphanTab(null);
GroupItems.setActiveOrphanTab(null);
TabItems.resumePainting();
@ -1015,10 +1015,8 @@ window.TabItems = {
if (groupItem) {
groupItem.add(item);
if (item.tab == gBrowser.selectedTab) {
if (item.tab == gBrowser.selectedTab)
GroupItems.setActiveGroupItem(item.parent);
GroupItems.updateTabBarForActiveGroupItem();
}
}
}

View File

@ -356,9 +356,11 @@ var UIManager = {
self.setActiveTab(item);
var activeGroupItem = GroupItems.getActiveGroupItem();
if (activeGroupItem)
activeGroupItem.setTopChild(item);
if (item.parent) {
var activeGroupItem = GroupItems.getActiveGroupItem();
if (activeGroupItem)
activeGroupItem.setTopChild(item);
}
self._resize(true);
dispatchEvent(event);
@ -530,7 +532,12 @@ var UIManager = {
var newItem = null;
if (focusTab && focusTab.tabItem) {
newItem = focusTab.tabItem;
GroupItems.setActiveGroupItem(newItem.parent);
if (newItem.parent) {
GroupItems.setActiveGroupItem(newItem.parent);
} else {
GroupItems.setActiveGroupItem(null);
GroupItems.setActiveOrphanTab(newItem);
}
GroupItems.updateTabBarForActiveGroupItem();
}
@ -712,7 +719,7 @@ var UIManager = {
var activeTab = self.getActiveTab();
if (activeTab) {
var tabItems = (activeTab.parent ? activeTab.parent.getChildren() :
GroupItems.getOrphanedTabs());
[activeTab]);
var length = tabItems.length;
var currentIndex = tabItems.indexOf(activeTab);
@ -745,8 +752,8 @@ var UIManager = {
const minSize = 60;
const minMinSize = 15;
let lastActiveGroupItem = GroupItems.getActiveGroupItem();
GroupItems.setActiveGroupItem(null);
let lastActiveGroupItem = GroupItems.getActiveGroupItem();
GroupItems.setActiveGroupItem(null);
var startPos = { x: e.clientX, y: e.clientY };
var phantom = iQ("<div>")