Bug 777236 - Implement the "fullscreen" app manifest attribute for web apps on desktop. r=myk

This commit is contained in:
Marco Castelluccio 2013-08-26 15:04:17 -04:00
Родитель be2b91609d
Коммит f8f8b309a2
2 изменённых файлов: 32 добавлений и 0 удалений

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

@ -58,6 +58,10 @@ function onLoad() {
// This doesn't capture clicks so content can capture them itself and do
// something different if it doesn't want the default behavior.
gAppBrowser.addEventListener("click", onContentClick, false, true);
if (WebappRT.config.app.manifest.fullscreen) {
enterFullScreen();
}
}
window.addEventListener("load", onLoad, false);
@ -66,6 +70,33 @@ function onUnload() {
}
window.addEventListener("unload", onUnload, false);
// Fullscreen handling.
function enterFullScreen() {
// We call mozRequestFullScreen here so that the app window goes in
// fullscreen mode as soon as it's loaded and not after the <browser>
// content is loaded.
gAppBrowser.mozRequestFullScreen();
// We need to call mozRequestFullScreen on the document element too,
// otherwise the app isn't aware of the fullscreen status.
gAppBrowser.addEventListener("load", function onLoad() {
gAppBrowser.removeEventListener("load", onLoad, true);
gAppBrowser.contentDocument.
documentElement.wrappedJSObject.mozRequestFullScreen();
}, true);
}
#ifndef XP_MACOSX
document.addEventListener('mozfullscreenchange', function() {
if (document.mozFullScreenElement) {
document.getElementById("main-menubar").style.display = "none";
} else {
document.getElementById("main-menubar").style.display = "";
}
}, false);
#endif
/**
* Direct a click on <a target="_blank"> to the user's default browser.
*

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

@ -17,6 +17,7 @@
id="default"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
width="1024" height="768"
fullscreenbutton="true"
persist="screenX screenY width height sizemode"
>