Bug 702159 - Add context menu to exit DOM full screen mode and tests. r=jaws

This commit is contained in:
Dan Wendorf
2012-05-24 23:57:59 -05:00
parent 9b00905e38
commit fe811e68b8
5 changed files with 73 additions and 7 deletions

View File

@@ -54,6 +54,7 @@ nsContextMenu.prototype = {
this.initSaveItems();
this.initClipboardItems();
this.initMediaPlayerItems();
this.initLeaveDOMFullScreenItems();
},
initPageMenuSeparator: function CM_initPageMenuSeparator() {
@@ -155,6 +156,16 @@ nsContextMenu.prototype = {
//this.setItemAttrFromNode( "context-stop", "disabled", "canStop" );
},
initLeaveDOMFullScreenItems: function CM_initLeaveFullScreenItem() {
// only show the option if the user is in DOM fullscreen
var shouldShow = (this.target.ownerDocument.mozFullScreenElement != null);
this.showItem("context-leave-dom-fullscreen", shouldShow);
// Explicitly show if in DOM fullscreen, but do not hide it has already been shown
if (shouldShow)
this.showItem("context-media-sep-commands", true);
},
initSaveItems: function CM_initSaveItems() {
var shouldShow = !(this.onTextInput || this.onLink ||
this.isContentSelected || this.onImage ||
@@ -819,6 +830,10 @@ nsContextMenu.prototype = {
video.mozRequestFullScreen();
},
leaveDOMFullScreen: function() {
document.mozCancelFullScreen();
},
// Change current window to the URL of the background image.
viewBGImage: function(e) {
urlSecurityCheck(this.bgImageURL,