Bug 639705 (Lion Full Screen) Part 3: Make Firefox support Lion Full Screen on browser windows [r=dao]

--HG--
extra : rebase_source : 5bd252ce3fde6d008c3e9b4335903d8480d31bbf
This commit is contained in:
Paul O’Shannessy 2012-03-20 16:21:15 -07:00
Родитель 36dd7de41e
Коммит 62ec9ec258
2 изменённых файлов: 33 добавлений и 4 удалений

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

@ -3916,10 +3916,23 @@ var FullScreen = {
if (event && event.type == "fullscreen")
enterFS = !enterFS;
// show/hide all menubars, toolbars (except the full screen toolbar)
this.showXULChrome("toolbar", !enterFS);
// Toggle the View:FullScreen command, which controls elements like the
// fullscreen menuitem, menubars, and the appmenu.
document.getElementById("View:FullScreen").setAttribute("checked", enterFS);
// On OS X Lion we don't want to hide toolbars when entering fullscreen, unless
// we're entering DOM fullscreen, in which case we should hide the toolbars.
// If we're leaving fullscreen, then we'll go through the exit code below to
// make sure toolbars are made visible in the case of DOM fullscreen.
if (enterFS && this.useLionFullScreen) {
if (document.mozFullScreen)
this.showXULChrome("toolbar", false);
return;
}
// show/hide menubars, toolbars (except the full screen toolbar)
this.showXULChrome("toolbar", !enterFS);
if (enterFS) {
// Add a tiny toolbar to receive mouseover and dragenter events, and provide affordance.
// This will help simulate the "collapse" metaphor while also requiring less code and
@ -4026,7 +4039,8 @@ var FullScreen = {
gBrowser.tabContainer.addEventListener("TabSelect", this.exitDomFullScreen);
// Exit DOM full-screen mode when the browser window loses focus (ALT+TAB, etc).
if (gPrefService.getBoolPref("full-screen-api.exit-on-deactivate")) {
if (!this.useLionFullScreen &&
gPrefService.getBoolPref("full-screen-api.exit-on-deactivate")) {
window.addEventListener("deactivate", this);
}
@ -4062,7 +4076,9 @@ var FullScreen = {
gBrowser.tabContainer.removeEventListener("TabOpen", this.exitDomFullScreen);
gBrowser.tabContainer.removeEventListener("TabClose", this.exitDomFullScreen);
gBrowser.tabContainer.removeEventListener("TabSelect", this.exitDomFullScreen);
window.removeEventListener("deactivate", this);
if (this.useLionFullScreen) {
window.removeEventListener("deactivate", this);
}
}
},
@ -4412,6 +4428,18 @@ var FullScreen = {
controls[i].hidden = aShow;
}
};
XPCOMUtils.defineLazyGetter(FullScreen, "useLionFullScreen", function() {
// We'll only use OS X Lion full screen if we're
// * on OS X
// * on Lion (Darwin 11.x) -- this will need to be updated for OS X 10.8
// * have fullscreenbutton="true"
#ifdef XP_MACOSX
return /^11\./.test(Services.sysinfo.getProperty("version")) &&
document.documentElement.getAttribute("fullscreenbutton") == "true";
#else
return false;
#endif
});
/**
* Returns true if |aMimeType| is text-based, false otherwise.

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

@ -94,6 +94,7 @@
macanimationtype="document"
screenX="4" screenY="4"
browsingmode="normal"
fullscreenbutton="true"
persist="screenX screenY width height sizemode">
# All JS files which are not content (only) dependent that browser.xul