This commit is contained in:
Tim Taubert 2011-10-31 11:13:42 +01:00
Родитель 8d30b97900 7bf3f658e1
Коммит a8494a42c6
4 изменённых файлов: 84 добавлений и 11 удалений

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

@ -152,7 +152,7 @@ function TabItem(tab, options) {
// ___ reconnect to data from Storage
if (!TabItems.reconnectingPaused())
this._reconnect();
this._reconnect(options);
};
TabItem.prototype = Utils.extend(new Item(), new Subscribable(), {
@ -339,11 +339,19 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), {
// Function: _reconnect
// Load the reciever's persistent data from storage. If there is none,
// treats it as a new tab.
_reconnect: function TabItem__reconnect() {
//
// Parameters:
// options - an object with additional parameters, see below
//
// Possible options:
// groupItemId - if the tab doesn't have any data associated with it and
// groupItemId is available, add the tab to that group.
_reconnect: function TabItem__reconnect(options) {
Utils.assertThrow(!this._reconnected, "shouldn't already be reconnected");
Utils.assertThrow(this.tab, "should have a xul:tab");
let tabData = Storage.getTabData(this.tab);
let groupItem;
if (tabData && TabItems.storageSanity(tabData)) {
this.loadThumbnail(tabData);
@ -351,13 +359,10 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), {
if (this.parent)
this.parent.remove(this, {immediately: true});
let groupItem;
if (tabData.groupID) {
if (tabData.groupID)
groupItem = GroupItems.groupItem(tabData.groupID);
} else {
else
groupItem = new GroupItem([], {immediately: true, bounds: tabData.bounds});
}
if (groupItem) {
groupItem.add(this, {immediately: true});
@ -373,8 +378,15 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), {
UI.setActive(this.parent);
}
} else {
// create tab group by double click is handled in UI_init().
GroupItems.newTab(this, {immediately: true});
if (options && options.groupItemId)
groupItem = GroupItems.groupItem(options.groupItemId);
if (groupItem) {
groupItem.add(this, {immediately: true});
} else {
// create tab group by double click is handled in UI_init().
GroupItems.newTab(this, {immediately: true});
}
}
this._reconnected = true;
@ -834,12 +846,21 @@ let TabItems = {
AllTabs.register(name, this._eventListeners[name]);
}
let activeGroupItem = GroupItems.getActiveGroupItem();
let activeGroupItemId = activeGroupItem ? activeGroupItem.id : null;
// For each tab, create the link.
AllTabs.tabs.forEach(function (tab) {
if (tab.pinned)
return;
self.link(tab, {immediately: true});
let options = {immediately: true};
// if tab is visible in the tabstrip and doesn't have any data stored in
// the session store (see TabItem__reconnect), it implies that it is a
// new tab which is created before Panorama is initialized. Therefore,
// passing the active group id to the link() method for setting it up.
if (!tab.hidden && activeGroupItemId)
options.groupItemId = activeGroupItemId;
self.link(tab, options);
self.update(tab);
});
},

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

@ -163,6 +163,7 @@ _BROWSER_FILES = \
browser_tabview_bug685476.js \
browser_tabview_bug685692.js \
browser_tabview_bug686654.js \
browser_tabview_bug697390.js \
browser_tabview_click_group.js \
browser_tabview_dragdrop.js \
browser_tabview_exit_button.js \

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

@ -0,0 +1,51 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
let state = {
windows: [{
tabs: [{
entries: [{ url: "about:blank" }],
hidden: true,
extData: {"tabview-tab": '{"url":"about:blank","groupID":1,"bounds":{"left":120,"top":20,"width":20,"height":20}}'}
},{
entries: [{ url: "about:blank" }],
hidden: false,
extData: {"tabview-tab": '{"url":"about:blank","groupID":2,"bounds":{"left":20,"top":20,"width":20,"height":20}}'},
}],
selected: 2,
extData: {
"tabview-groups": '{"nextID":3,"activeGroupId":2, "totalNumber":2}',
"tabview-group":
'{"1":{"bounds":{"left":15,"top":5,"width":280,"height":232},"id":1},' +
'"2":{"bounds":{"left":309,"top":5,"width":267,"height":226},"id":2}}'
}
}]
};
function test() {
waitForExplicitFinish();
newWindowWithState(state, function(win) {
registerCleanupFunction(function() win.close());
win.gBrowser.addTab();
ok(win.gBrowser.tabs[0].hidden, "The first tab is hidden");
win.gBrowser.selectedTab = win.gBrowser.tabs[0];
function onTabViewFrameInitialized() {
win.removeEventListener(
"tabviewframeinitialized", onTabViewFrameInitialized, false);
let cw = win.TabView.getContentWindow();
is(cw.GroupItems.groupItem(1).getChild(0).tab, win.gBrowser.selectedTab, "The tab in group one matches the selected tab");
is(cw.GroupItems.groupItem(1).getChildren().length, 1, "The group one has only one tab item");
is(cw.GroupItems.groupItem(2).getChildren().length, 2, "The group one has only two tab item")
finish();
}
win.addEventListener(
"tabviewframeinitialized", onTabViewFrameInitialized, false);
});
}

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

@ -876,7 +876,7 @@
let srcIdx = srcParts.length - 1;
if (src.lastIndexOf('/') == src.length - 1)
srcIdx--;
s.filename.textContent = srcParts[srcIdx];
s.filename.textContent = decodeURI(srcParts[srcIdx]);
let size = v.videoWidth + "x" + v.videoHeight;
if (this._getComputedPropertyValueAsInt(this.video, "width") != v.videoWidth || this._getComputedPropertyValueAsInt(this.video, "height") != v.videoHeight)