зеркало из https://github.com/mozilla/gecko-dev.git
Bug 777236 - Implement the "fullscreen" app manifest attribute for web apps on desktop. r=myk
This commit is contained in:
Родитель
be2b91609d
Коммит
f8f8b309a2
|
@ -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"
|
||||
>
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче