mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-03 23:30:46 +00:00
Bug 699885 part 2 - Exit DOM full-screen if we've changed tab or app by the time the request is granted. r=dao
This commit is contained in:
parent
e4244a4646
commit
bb48204f31
@ -3913,14 +3913,36 @@ var FullScreen = {
|
||||
},
|
||||
|
||||
enterDomFullScreen : function(event) {
|
||||
if (!document.mozFullScreen) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We receive "mozfullscreenchange" events for each subdocument which
|
||||
// is an ancestor of the document containing the element which requested
|
||||
// full-screen. Only add listeners and show warning etc when the event we
|
||||
// receive is targeted at the chrome document, i.e. only once every time
|
||||
// we enter DOM full-screen mode.
|
||||
if (!document.mozFullScreen || event.target.ownerDocument != document) {
|
||||
let targetDoc = event.target.ownerDocument ? event.target.ownerDocument : event.target;
|
||||
if (targetDoc != document) {
|
||||
// However, if we receive a "mozfullscreenchange" event for a document
|
||||
// which is not a subdocument of the currently selected tab, we know that
|
||||
// we've switched tabs since the request to enter full-screen was made,
|
||||
// so we should exit full-screen since the "full-screen document" isn't
|
||||
// acutally visible.
|
||||
if (targetDoc.defaultView.top != gBrowser.contentWindow) {
|
||||
document.mozCancelFullScreen();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
let focusManger = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
|
||||
if (focusManger.activeWindow != window) {
|
||||
// The top-level window has lost focus since the request to enter
|
||||
// full-screen was made. Cancel full-screen.
|
||||
document.mozCancelFullScreen();
|
||||
return;
|
||||
}
|
||||
|
||||
this.showWarning(true);
|
||||
|
||||
// Exit DOM full-screen mode upon open, close, or change tab.
|
||||
|
Loading…
x
Reference in New Issue
Block a user