Bug 686380 - Hide the undo close tab thumbnail when switching or opening tabs [r=mfinkle]

This commit is contained in:
Matt Brubeck 2011-09-14 06:39:25 -07:00
Родитель 6b7f9a25b8
Коммит 3cb012c08e
3 изменённых файлов: 25 добавлений и 20 удалений

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

@ -64,6 +64,7 @@ let Elements = {};
["contentShowing", "bcast_contentShowing"],
["urlbarState", "bcast_urlbarState"],
["stack", "stack"],
["tabList", "tabs"],
["tabs", "tabs-container"],
["controls", "browser-controls"],
["panelUI", "panel-container"],
@ -383,7 +384,7 @@ var BrowserUI = {
sizeControls: function(windowW, windowH) {
// tabs
document.getElementById("tabs").resize();
Elements.tabList.resize();
AwesomeScreen.doResize(windowW, windowH);
// content navigator helper
@ -665,6 +666,7 @@ var BrowserUI = {
// new page is opened, so a call to Browser.hideSidebars() fill this
// requirement and fix the sidebars position.
Browser.hideSidebars();
Elements.tabList.removeClosedTab();
// Delay doing the fixup so the raw URI is passed to loadURIWithFlags
// and the proper third-party fixup can be done
@ -781,6 +783,7 @@ var BrowserUI = {
selectTab: function selectTab(aTab) {
AwesomeScreen.activePanel = null;
Browser.selectedTab = aTab;
Elements.tabList.removeClosedTab();
},
undoCloseTab: function undoCloseTab(aIndex) {
@ -907,18 +910,14 @@ var BrowserUI = {
this._tabSelect(aEvent);
break;
case "TabOpen":
case "TabRemove":
{
// Workaround to hide the tabstrip if it is partially visible
// See bug 524469 and bug 626660
let [tabsVisibility,,,] = Browser.computeSidebarVisibility();
if (tabsVisibility > 0.0 && tabsVisibility < 1.0)
Browser.hideSidebars();
Elements.tabList.removeClosedTab();
Browser.hidePartialTabSidebar();
break;
}
case "PanFinished":
let tabs = document.getElementById("tabs");
case "TabRemove":
Browser.hidePartialTabSidebar();
break;
case "PanFinished": {
let tabs = Elements.tabList;
let [tabsVisibility,,oldLeftWidth, oldRightWidth] = Browser.computeSidebarVisibility();
if (tabsVisibility == 0.0 && tabs.hasClosedTab) {
let { x: x1, y: y1 } = Browser.getScrollboxPosition(Browser.controlsScrollboxScroller);
@ -936,6 +935,7 @@ var BrowserUI = {
Browser.tryFloatToolbar(0, 0);
}
break;
}
case "SizeChanged":
this.sizeControls(ViewableAreaObserver.width, ViewableAreaObserver.height);
break;

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

@ -554,6 +554,13 @@ var Browser = {
this.tryUnfloatToolbar();
},
/** Workaround to hide the tabstrip if it is partially visible (bug 524469 and bug 626660) */
hidePartialTabSidebar: function hidePartialSidebars() {
let [tabsVisibility,,,] = this.computeSidebarVisibility();
if (tabsVisibility > 0.0 && tabsVisibility < 1.0)
this.hideSidebars();
},
hideTitlebar: function hideTitlebar() {
let rect = Elements.browsers.getBoundingClientRect();
this.pageScrollboxScroller.scrollBy(0, Math.round(rect.top));
@ -2847,7 +2854,7 @@ Tab.prototype = {
},
create: function create(aURI, aParams) {
this._chromeTab = document.getElementById("tabs").addTab();
this._chromeTab = Elements.tabList.addTab();
let browser = this._createBrowser(aURI, null);
// Should we fully load the new browser, or wait until later
@ -2866,7 +2873,7 @@ Tab.prototype = {
},
destroy: function destroy() {
document.getElementById("tabs").removeTab(this._chromeTab);
Elements.tabList.removeTab(this._chromeTab);
this._chromeTab = null;
this._destroyBrowser();
},
@ -3092,7 +3099,7 @@ Tab.prototype = {
browser.setAttribute("type", "content-primary");
Elements.browsers.selectedPanel = notification;
browser.active = true;
document.getElementById("tabs").selectedTab = this._chromeTab;
Elements.tabList.selectedTab = this._chromeTab;
browser.focus();
} else {
browser.messageManager.sendAsyncMessage("Browser:Blur", { });

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

@ -445,13 +445,11 @@ var NewTabPopup = {
let boxRect = this.box.getBoundingClientRect();
this.box.top = tabRect.top + (tabRect.height / 2) - (boxRect.height / 2);
let tabs = document.getElementById("tabs");
// We don't use anchorTo() here because the tab
// being anchored to might be overflowing the tabs
// scrollbox which confuses the dynamic arrow direction
// calculation (see bug 662520).
if (tabs.getBoundingClientRect().left < 0)
if (Elements.tabList.getBoundingClientRect().left < 0)
this.box.pointLeftAt(aTab);
else
this.box.pointRightAt(aTab);
@ -523,7 +521,7 @@ var FindHelperUI = {
Elements.browsers.addEventListener("PanFinished", this, false);
// Listen for events where form assistant should be closed
document.getElementById("tabs").addEventListener("TabSelect", this, true);
Elements.tabList.addEventListener("TabSelect", this, true);
Elements.browsers.addEventListener("URLChanged", this, true);
},
@ -675,7 +673,7 @@ var FormHelperUI = {
messageManager.addMessageListener("FormAssist:AutoComplete", this);
// Listen for events where form assistant should be closed or updated
let tabs = document.getElementById("tabs");
let tabs = Elements.tabList;
tabs.addEventListener("TabSelect", this, true);
tabs.addEventListener("TabClose", this, true);
Elements.browsers.addEventListener("URLChanged", this, true);