Backed out changeset 09a4e390e1ec

This commit is contained in:
Dão Gottwald 2008-09-17 17:06:54 +02:00
Родитель 6e5239f8c9
Коммит 84f07e43f0
3 изменённых файлов: 51 добавлений и 24 удалений

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

@ -309,7 +309,8 @@ pref("browser.link.open_newwindow", 3);
pref("browser.link.open_newwindow.restriction", 2);
// Tabbed browser
pref("browser.tabs.autoHide", false);
pref("browser.tabs.autoHide", true);
pref("browser.tabs.forceHide", false);
pref("browser.tabs.warnOnClose", true);
pref("browser.tabs.warnOnOpen", true);
pref("browser.tabs.maxOpenBeforeWarn", 15);

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

@ -1313,6 +1313,7 @@ AutoHideTabbarPrefListener.prototype =
catch (e) {
}
gBrowser.setStripVisibilityTo(aVisible);
gPrefService.setBoolPref("browser.tabs.forceHide", false);
}
}
}
@ -1635,7 +1636,8 @@ function BrowserOpenFileWindow()
}
}
function BrowserCloseTabOrWindow() {
function BrowserCloseTabOrWindow()
{
#ifdef XP_MACOSX
// If we're not a browser window, just close the window
if (window.location.href != getBrowserURL()) {
@ -1644,8 +1646,23 @@ function BrowserCloseTabOrWindow() {
}
#endif
// If the current tab is the last one, this will close the window.
gBrowser.removeCurrentTab();
if (gBrowser.tabContainer.childNodes.length > 1) {
gBrowser.removeCurrentTab();
return;
}
#ifndef XP_MACOSX
if (gBrowser.localName == "tabbrowser" && window.toolbar.visible &&
!gPrefService.getBoolPref("browser.tabs.autoHide")) {
// Replace the remaining tab with a blank one and focus the address bar
gBrowser.removeCurrentTab();
if (gURLBar)
setTimeout(function() { gURLBar.focus(); }, 0);
return;
}
#endif
closeWindow(true);
}
function BrowserTryToCloseWindow()

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

@ -1217,6 +1217,8 @@
if (this.mStrip.collapsed)
this.setStripVisibilityTo(true);
this.mPrefs.setBoolPref("browser.tabs.forceHide", false);
// wire up a progress listener for the new browser object.
var position = this.mTabContainer.childNodes.length-1;
var tabListener = this.mTabProgressListener(t, b, blank);
@ -1402,31 +1404,40 @@
if (aTab.localName != "tab")
aTab = this.mCurrentTab;
if (aFireBeforeUnload) {
let ds = this.getBrowserForTab(aTab).docShell;
if (ds.contentViewer && !ds.contentViewer.permitUnload())
return null;
var l = this.mTabContainer.childNodes.length;
if (l == 1 && this.mPrefs.getBoolPref("browser.tabs.autoHide")) {
// hide the tab bar
this.mPrefs.setBoolPref("browser.tabs.forceHide", true);
this.setStripVisibilityTo(false);
return;
}
var l = this.mTabContainer.childNodes.length;
if (l == 1) {
closeWindow(true);
return null;
if (aFireBeforeUnload) {
var ds = this.getBrowserForTab(aTab).docShell;
if (ds.contentViewer && !ds.contentViewer.permitUnload())
return;
}
if (l == 2) {
// see notes in addTab
var _delayedUpdate = function(aTabContainer) {
aTabContainer.adjustTabstrip();
aTabContainer.mTabstrip._updateScrollButtonsDisabledState();
}
setTimeout(_delayedUpdate, 0, this.mTabContainer);
if (l == 1) {
// add a new blank tab to replace the one we're about to close
// (this ensures that the remaining tab is as good as new)
this.addTab("about:blank");
l++;
}
else if (l == 2) {
var autohide = this.mPrefs.getBoolPref("browser.tabs.autoHide");
var tabStripHide = !window.toolbar.visible;
if (autohide || tabStripHide)
this.setStripVisibilityTo(false);
}
// see notes in addTab
var _delayedUpdate = function (aTabContainer) {
aTabContainer.adjustTabstrip();
aTabContainer.mTabstrip._updateScrollButtonsDisabledState();
};
setTimeout(_delayedUpdate, 0, this.mTabContainer);
// We're committed to closing the tab now.
// Dispatch a notification.
// We dispatch it before any teardown so that event listeners can
@ -1468,9 +1479,6 @@
<parameter name="aTab"/>
<body>
<![CDATA[
if (!aTab)
return null;
var browser = this.getBrowserForTab(aTab);
var length = this.mTabs.length;
@ -1660,8 +1668,9 @@
if (!this.mAddProgressListenerWasCalled) {
this.mAddProgressListenerWasCalled = true;
var autoHide = this.mPrefs.getBoolPref("browser.tabs.autoHide");
var forceHide = this.mPrefs.getBoolPref("browser.tabs.forceHide");
var tabStripHide = !window.toolbar.visible;
if (!autoHide && !tabStripHide)
if (!autoHide && !forceHide && !tabStripHide)
this.setStripVisibilityTo(true);
}