зеркало из https://github.com/mozilla/gecko-dev.git
Bug 611715 - Rename tab.tabItem. r=ian a=beltzner
This commit is contained in:
Родитель
f1787d896e
Коммит
8ae932d6da
|
@ -172,8 +172,8 @@ let TabView = {
|
|||
// will not have happened by the time the browser tries to
|
||||
// update the title.
|
||||
let activeTab = window.gBrowser.selectedTab;
|
||||
if (activeTab.tabItem && activeTab.tabItem.parent){
|
||||
let groupName = activeTab.tabItem.parent.getTitle();
|
||||
if (activeTab._tabViewTabItem && activeTab._tabViewTabItem.parent){
|
||||
let groupName = activeTab._tabViewTabItem.parent.getTitle();
|
||||
if (groupName)
|
||||
return groupName;
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ let TabView = {
|
|||
|
||||
let self = this;
|
||||
this._initFrame(function() {
|
||||
let activeGroup = tab.tabItem.parent;
|
||||
let activeGroup = tab._tabViewTabItem.parent;
|
||||
let groupItems = self._window.GroupItems.groupItems;
|
||||
|
||||
groupItems.forEach(function(groupItem) {
|
||||
|
|
|
@ -1462,7 +1462,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
// TabItems will have handled the new tab and added the tabItem property.
|
||||
// We don't have to check if it's an app tab (and therefore wouldn't have a
|
||||
// TabItem), since we've just created it.
|
||||
newTab.tabItem.zoomIn(!url);
|
||||
newTab._tabViewTabItem.zoomIn(!url);
|
||||
},
|
||||
|
||||
// ----------
|
||||
|
@ -1893,15 +1893,15 @@ let GroupItems = {
|
|||
// find first visible non-app tab in the tabbar.
|
||||
gBrowser.visibleTabs.some(function(tab) {
|
||||
if (!tab.pinned && tab != tabItem.tab) {
|
||||
if (tab.tabItem) {
|
||||
if (!tab.tabItem.parent) {
|
||||
if (tab._tabViewTabItem) {
|
||||
if (!tab._tabViewTabItem.parent) {
|
||||
// the first visible tab is an orphan tab, set the orphan tab, and
|
||||
// create a new group for orphan tab and new tabItem
|
||||
orphanTabItem = tab.tabItem;
|
||||
} else if (!tab.tabItem.parent.hidden) {
|
||||
orphanTabItem = tab._tabViewTabItem;
|
||||
} else if (!tab._tabViewTabItem.parent.hidden) {
|
||||
// the first visible tab belongs to a group, add the new tabItem to
|
||||
// that group
|
||||
targetGroupItem = tab.tabItem.parent;
|
||||
targetGroupItem = tab._tabViewTabItem.parent;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -2173,7 +2173,7 @@ let GroupItems = {
|
|||
if (tab.pinned)
|
||||
return;
|
||||
|
||||
Utils.assertThrow(tab.tabItem, "tab must be linked to a TabItem");
|
||||
Utils.assertThrow(tab._tabViewTabItem, "tab must be linked to a TabItem");
|
||||
|
||||
let shouldUpdateTabBar = false;
|
||||
let shouldShowTabView = false;
|
||||
|
@ -2198,13 +2198,13 @@ let GroupItems = {
|
|||
shouldUpdateTabBar = true
|
||||
|
||||
// remove tab item from a groupItem
|
||||
if (tab.tabItem.parent)
|
||||
tab.tabItem.parent.remove(tab.tabItem);
|
||||
if (tab._tabViewTabItem.parent)
|
||||
tab._tabViewTabItem.parent.remove(tab._tabViewTabItem);
|
||||
|
||||
// add tab item to a groupItem
|
||||
if (groupItemId) {
|
||||
groupItem = GroupItems.groupItem(groupItemId);
|
||||
groupItem.add(tab.tabItem);
|
||||
groupItem.add(tab._tabViewTabItem);
|
||||
UI.setReorderTabItemsOnShow(groupItem);
|
||||
} else {
|
||||
let pageBounds = Items.getPageBounds();
|
||||
|
@ -2214,13 +2214,13 @@ let GroupItems = {
|
|||
box.width = 250;
|
||||
box.height = 200;
|
||||
|
||||
new GroupItem([ tab.tabItem ], { bounds: box });
|
||||
new GroupItem([ tab._tabViewTabItem ], { bounds: box });
|
||||
}
|
||||
|
||||
if (shouldUpdateTabBar)
|
||||
this._updateTabBar();
|
||||
else if (shouldShowTabView) {
|
||||
tab.tabItem.setZoomPrep(false);
|
||||
tab._tabViewTabItem.setZoomPrep(false);
|
||||
UI.showTabView();
|
||||
}
|
||||
},
|
||||
|
|
|
@ -53,7 +53,7 @@ function TabItem(tab, options) {
|
|||
|
||||
this.tab = tab;
|
||||
// register this as the tab's tabItem
|
||||
this.tab.tabItem = this;
|
||||
this.tab._tabViewTabItem = this;
|
||||
|
||||
if (!options)
|
||||
options = {};
|
||||
|
@ -883,7 +883,7 @@ let TabItems = {
|
|||
try {
|
||||
Utils.assertThrow(tab, "tab");
|
||||
Utils.assertThrow(!tab.pinned, "shouldn't be an app tab");
|
||||
Utils.assertThrow(tab.tabItem, "should already be linked");
|
||||
Utils.assertThrow(tab._tabViewTabItem, "should already be linked");
|
||||
|
||||
let shouldDefer = (
|
||||
this.isPaintingPaused() ||
|
||||
|
@ -923,8 +923,8 @@ let TabItems = {
|
|||
this._tabsWaitingForUpdate.splice(index, 1);
|
||||
|
||||
// ___ get the TabItem
|
||||
Utils.assertThrow(tab.tabItem, "must already be linked");
|
||||
let tabItem = tab.tabItem;
|
||||
Utils.assertThrow(tab._tabViewTabItem, "must already be linked");
|
||||
let tabItem = tab._tabViewTabItem;
|
||||
|
||||
// ___ icon
|
||||
let iconUrl = tab.image;
|
||||
|
@ -979,8 +979,8 @@ let TabItems = {
|
|||
try {
|
||||
Utils.assertThrow(tab, "tab");
|
||||
Utils.assertThrow(!tab.pinned, "shouldn't be an app tab");
|
||||
Utils.assertThrow(!tab.tabItem, "shouldn't already be linked");
|
||||
new TabItem(tab, options); // sets tab.tabItem to itself
|
||||
Utils.assertThrow(!tab._tabViewTabItem, "shouldn't already be linked");
|
||||
new TabItem(tab, options); // sets tab._tabViewTabItem to itself
|
||||
} catch(e) {
|
||||
Utils.log(e);
|
||||
}
|
||||
|
@ -992,16 +992,16 @@ let TabItems = {
|
|||
unlink: function TabItems_unlink(tab) {
|
||||
try {
|
||||
Utils.assertThrow(tab, "tab");
|
||||
Utils.assertThrow(tab.tabItem, "should already be linked");
|
||||
Utils.assertThrow(tab._tabViewTabItem, "should already be linked");
|
||||
// note that it's ok to unlink an app tab; see .handleTabUnpin
|
||||
|
||||
this.unregister(tab.tabItem);
|
||||
tab.tabItem._sendToSubscribers("close");
|
||||
iQ(tab.tabItem.container).remove();
|
||||
tab.tabItem.removeTrenches();
|
||||
Items.unsquish(null, tab.tabItem);
|
||||
this.unregister(tab._tabViewTabItem);
|
||||
tab._tabViewTabItem._sendToSubscribers("close");
|
||||
iQ(tab._tabViewTabItem.container).remove();
|
||||
tab._tabViewTabItem.removeTrenches();
|
||||
Items.unsquish(null, tab._tabViewTabItem);
|
||||
|
||||
tab.tabItem = null;
|
||||
tab._tabViewTabItem = null;
|
||||
Storage.saveTab(tab, null);
|
||||
|
||||
let index = this._tabsWaitingForUpdate.indexOf(tab);
|
||||
|
|
|
@ -303,7 +303,7 @@ let UI = {
|
|||
|
||||
let url = gPrefBranch.getCharPref("welcome_url");
|
||||
let newTab = gBrowser.loadOneTab(url, {inBackground: true});
|
||||
let newTabItem = newTab.tabItem;
|
||||
let newTabItem = newTab._tabViewTabItem;
|
||||
let parent = newTabItem.parent;
|
||||
Utils.assert(parent, "should have a parent");
|
||||
|
||||
|
@ -428,15 +428,15 @@ let UI = {
|
|||
let event = document.createEvent("Events");
|
||||
event.initEvent("tabviewshown", true, false);
|
||||
|
||||
if (zoomOut && currentTab && currentTab.tabItem) {
|
||||
item = currentTab.tabItem;
|
||||
if (zoomOut && currentTab && currentTab._tabViewTabItem) {
|
||||
item = currentTab._tabViewTabItem;
|
||||
// If there was a previous currentTab we want to animate
|
||||
// its thumbnail (canvas) for the zoom out.
|
||||
// Note that we start the animation on the chrome thread.
|
||||
|
||||
// Zoom out!
|
||||
item.zoomOut(function() {
|
||||
if (!currentTab.tabItem) // if the tab's been destroyed
|
||||
if (!currentTab._tabViewTabItem) // if the tab's been destroyed
|
||||
item = null;
|
||||
|
||||
self.setActiveTab(item);
|
||||
|
@ -451,8 +451,8 @@ let UI = {
|
|||
dispatchEvent(event);
|
||||
});
|
||||
} else {
|
||||
if (currentTab && currentTab.tabItem)
|
||||
currentTab.tabItem.setZoomPrep(false);
|
||||
if (currentTab && currentTab._tabViewTabItem)
|
||||
currentTab._tabViewTabItem.setZoomPrep(false);
|
||||
|
||||
self.setActiveTab(null);
|
||||
dispatchEvent(event);
|
||||
|
@ -664,8 +664,8 @@ let UI = {
|
|||
// for the tab focus event to pick up.
|
||||
self._closedLastVisibleTab = true;
|
||||
// remove the zoom prep.
|
||||
if (tab && tab.tabItem)
|
||||
tab.tabItem.setZoomPrep(false);
|
||||
if (tab && tab._tabViewTabItem)
|
||||
tab._tabViewTabItem.setZoomPrep(false);
|
||||
self.showTabView();
|
||||
}
|
||||
}
|
||||
|
@ -774,12 +774,12 @@ let UI = {
|
|||
let oldItem = null;
|
||||
let newItem = null;
|
||||
|
||||
if (currentTab && currentTab.tabItem)
|
||||
oldItem = currentTab.tabItem;
|
||||
if (currentTab && currentTab._tabViewTabItem)
|
||||
oldItem = currentTab._tabViewTabItem;
|
||||
|
||||
// update the tab bar for the new tab's group
|
||||
if (tab && tab.tabItem) {
|
||||
newItem = tab.tabItem;
|
||||
if (tab && tab._tabViewTabItem) {
|
||||
newItem = tab._tabViewTabItem;
|
||||
GroupItems.updateActiveGroupItemAndTabBar(newItem);
|
||||
} else {
|
||||
// No tabItem; must be an app tab. Base the tab bar on the current group.
|
||||
|
@ -789,7 +789,7 @@ let UI = {
|
|||
for (let a = 0; a < gBrowser.tabs.length; a++) {
|
||||
let theTab = gBrowser.tabs[a];
|
||||
if (!theTab.pinned) {
|
||||
let tabItem = theTab.tabItem;
|
||||
let tabItem = theTab._tabViewTabItem;
|
||||
if (tabItem.parent)
|
||||
GroupItems.setActiveGroupItem(tabItem.parent);
|
||||
else
|
||||
|
@ -1254,7 +1254,7 @@ let UI = {
|
|||
// selected tab is an app tab), just go there.
|
||||
let activeTabItem = this.getActiveTab();
|
||||
if (!activeTabItem) {
|
||||
let tabItem = gBrowser.selectedTab.tabItem;
|
||||
let tabItem = gBrowser.selectedTab._tabViewTabItem;
|
||||
if (tabItem) {
|
||||
if (!tabItem.parent || !tabItem.parent.hidden) {
|
||||
activeTabItem = tabItem;
|
||||
|
|
|
@ -61,7 +61,7 @@ function onTabViewWindowLoaded() {
|
|||
ok(testGroup.isEmpty(), "This group is empty");
|
||||
|
||||
// place tab in group
|
||||
let testTabItem = testTab.tabItem;
|
||||
let testTabItem = testTab._tabViewTabItem;
|
||||
|
||||
if (testTabItem.parent)
|
||||
testTabItem.parent.remove(testTabItem);
|
||||
|
@ -103,8 +103,8 @@ function onTabViewWindowLoaded() {
|
|||
ok((lastTime - initialUpdateTime) > hbTiming, "Tab has been updated:"+lastTime+"-"+initialUpdateTime+">"+hbTiming);
|
||||
|
||||
// clean up
|
||||
testGroup.remove(testTab.tabItem);
|
||||
testTab.tabItem.close();
|
||||
testGroup.remove(testTab._tabViewTabItem);
|
||||
testTab._tabViewTabItem.close();
|
||||
testGroup.close();
|
||||
|
||||
let currentTabs = contentWindow.TabItems.getItems();
|
||||
|
|
|
@ -55,7 +55,7 @@ function onTabViewWindowLoaded() {
|
|||
|
||||
// Create a first tab and orphan it
|
||||
let firstTab = gBrowser.loadOneTab("about:blank#1", {inBackground: true});
|
||||
let firstTabItem = firstTab.tabItem;
|
||||
let firstTabItem = firstTab._tabViewTabItem;
|
||||
let currentGroup = contentWindow.GroupItems.getActiveGroupItem();
|
||||
ok(currentGroup.getChildren().some(function(child) child == firstTabItem),"The first tab was made in the current group");
|
||||
contentWindow.GroupItems.getActiveGroupItem().remove(firstTabItem);
|
||||
|
@ -69,7 +69,7 @@ function onTabViewWindowLoaded() {
|
|||
|
||||
// Create a second tab in this new group
|
||||
let secondTab = gBrowser.loadOneTab("about:blank#2", {inBackground: true});
|
||||
let secondTabItem = secondTab.tabItem;
|
||||
let secondTabItem = secondTab._tabViewTabItem;
|
||||
ok(group.getChildren().some(function(child) child == secondTabItem),"The second tab was made in our new group");
|
||||
is(group.getChildren().length, 1, "Only one tab in the first group");
|
||||
isnot(firstTab.linkedBrowser.contentWindow.location, secondTab.linkedBrowser.contentWindow.location, "The two tabs must have different locations");
|
||||
|
|
|
@ -97,7 +97,7 @@ function testThree(contentWindow) {
|
|||
"tabviewsearchenabled", onSearchEnabled, false);
|
||||
|
||||
let searchBox = contentWindow.iQ("#searchbox");
|
||||
searchBox.val(newTabOne.tabItem.nameEl.innerHTML);
|
||||
searchBox.val(newTabOne._tabViewTabItem.nameEl.innerHTML);
|
||||
|
||||
contentWindow.performSearch();
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ function onTabViewWindowLoaded() {
|
|||
ok(group1.isEmpty(), "This group is empty");
|
||||
contentWindow.GroupItems.setActiveGroupItem(group1);
|
||||
let tab1 = gBrowser.loadOneTab("about:blank#1", {inBackground: true});
|
||||
let tab1Item = tab1.tabItem;
|
||||
let tab1Item = tab1._tabViewTabItem;
|
||||
ok(group1.getChildren().some(function(child) child == tab1Item), "The tab was made in our new group");
|
||||
is(group1.getChildren().length, 1, "Only one tab in the first group");
|
||||
|
||||
|
|
|
@ -102,6 +102,6 @@ function onTabViewWindowLoaded() {
|
|||
}
|
||||
|
||||
window.addEventListener("tabviewhidden", onTabViewHidden, false);
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" }, normalXulTab.tabItem.container, contentWindow);
|
||||
EventUtils.sendMouseEvent({ type: "mouseup" }, normalXulTab.tabItem.container, contentWindow);
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" }, normalXulTab._tabViewTabItem.container, contentWindow);
|
||||
EventUtils.sendMouseEvent({ type: "mouseup" }, normalXulTab._tabViewTabItem.container, contentWindow);
|
||||
}
|
|
@ -83,8 +83,8 @@ function onTabViewWindowLoaded() {
|
|||
is(groupItems[0].getChildren().length, 2, "The group has two tab items");
|
||||
|
||||
tabTwo = undoCloseTab(0);
|
||||
tabTwo.tabItem.addSubscriber(tabTwo, "reconnected", function() {
|
||||
tabTwo.tabItem.removeSubscriber(tabTwo, "reconnected");
|
||||
tabTwo._tabViewTabItem.addSubscriber(tabTwo, "reconnected", function() {
|
||||
tabTwo._tabViewTabItem.removeSubscriber(tabTwo, "reconnected");
|
||||
|
||||
ok(TabView.isVisible(), "Tab View is still visible after restoring a tab");
|
||||
is(groupItems[0].getChildren().length, 3, "The group still has three tab items");
|
||||
|
|
|
@ -63,7 +63,7 @@ function onTabViewWindowLoaded() {
|
|||
let contentWindow = newWin.document.getElementById("tab-view").contentWindow;
|
||||
|
||||
// 1) the tab should belong to a group, and no orphan tabs
|
||||
ok(tabOne.tabItem.parent, "Tab one belongs to a group");
|
||||
ok(tabOne._tabViewTabItem.parent, "Tab one belongs to a group");
|
||||
is(contentWindow.GroupItems.getOrphanedTabs().length, 0, "No orphaned tabs");
|
||||
|
||||
// 2) create a group, add a blank tab
|
||||
|
|
|
@ -147,7 +147,7 @@ function verifyCleanState(mode) {
|
|||
let prefix = "we " + (mode || "finish") + " with ";
|
||||
is(gBrowser.tabs.length, 1, prefix + "one tab");
|
||||
is(contentWindow.GroupItems.groupItems.length, 1, prefix + "1 group");
|
||||
ok(gBrowser.tabs[0].tabItem.parent == contentWindow.GroupItems.groupItems[0],
|
||||
ok(gBrowser.tabs[0]._tabViewTabItem.parent == contentWindow.GroupItems.groupItems[0],
|
||||
"the tab is in the group");
|
||||
ok(!pb.privateBrowsingEnabled, prefix + "private browsing off");
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ function verifyPB() {
|
|||
ok(pb.privateBrowsingEnabled == true, "private browsing is on");
|
||||
is(gBrowser.tabs.length, 1, "we have 1 tab in private browsing");
|
||||
is(contentWindow.GroupItems.groupItems.length, 1, "we have 1 group in private browsing");
|
||||
ok(gBrowser.tabs[0].tabItem.parent == contentWindow.GroupItems.groupItems[0],
|
||||
ok(gBrowser.tabs[0]._tabViewTabItem.parent == contentWindow.GroupItems.groupItems[0],
|
||||
"the tab is in the group");
|
||||
|
||||
let browser = gBrowser.tabs[0].linkedBrowser;
|
||||
|
@ -184,7 +184,7 @@ function verifyNormal() {
|
|||
let groupItem = contentWindow.GroupItems.groupItems[a];
|
||||
is(groupItem.getTitle(), groupTitles[a], prefix + "correct group title");
|
||||
|
||||
ok(tab.tabItem.parent == groupItem,
|
||||
ok(tab._tabViewTabItem.parent == groupItem,
|
||||
prefix + "tab " + a + " is in group " + a);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче