зеркало из https://github.com/mozilla/pjs.git
Bug 218142 - "Need "Show Image" / "Reload Image" on context menu" [p=ehsan.akhgari@gmail.com (Ehsan Akhgari [ehsan]) r=gavin ui-r+a1.9=beltzner]
This commit is contained in:
Родитель
a722eaaf8c
Коммит
b3ce085310
|
@ -74,6 +74,10 @@
|
||||||
accesskey="©LinkCmd.accesskey;"
|
accesskey="©LinkCmd.accesskey;"
|
||||||
oncommand="goDoCommand('cmd_copyLink');"/>
|
oncommand="goDoCommand('cmd_copyLink');"/>
|
||||||
<menuseparator id="context-sep-copylink"/>
|
<menuseparator id="context-sep-copylink"/>
|
||||||
|
<menuitem id="context-showimage"
|
||||||
|
label="&showImageCmd.label;"
|
||||||
|
accesskey="&showImageCmd.accesskey;"
|
||||||
|
oncommand="gContextMenu.showImage();"/>
|
||||||
<menuitem id="context-viewimage"
|
<menuitem id="context-viewimage"
|
||||||
label="&viewImageCmd.label;"
|
label="&viewImageCmd.label;"
|
||||||
accesskey="&viewImageCmd.accesskey;"
|
accesskey="&viewImageCmd.accesskey;"
|
||||||
|
|
|
@ -65,6 +65,7 @@ function nsContextMenu(aXulMenu, aBrowser) {
|
||||||
this.onKeywordField = false;
|
this.onKeywordField = false;
|
||||||
this.onImage = false;
|
this.onImage = false;
|
||||||
this.onLoadedImage = false;
|
this.onLoadedImage = false;
|
||||||
|
this.onCompletedImage = false;
|
||||||
this.onCanvas = false;
|
this.onCanvas = false;
|
||||||
this.onLink = false;
|
this.onLink = false;
|
||||||
this.onMailtoLink = false;
|
this.onMailtoLink = false;
|
||||||
|
@ -198,6 +199,9 @@ nsContextMenu.prototype = {
|
||||||
.disabled = this.disableSetDesktopBackground();
|
.disabled = this.disableSetDesktopBackground();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show image depends on an image that's not fully loaded
|
||||||
|
this.showItem("context-showimage", (this.onImage && !this.onCompletedImage));
|
||||||
|
|
||||||
// View image depends on having an image that's not standalone
|
// View image depends on having an image that's not standalone
|
||||||
// (or is in a frame), or a canvas.
|
// (or is in a frame), or a canvas.
|
||||||
this.showItem("context-viewimage", (this.onImage &&
|
this.showItem("context-viewimage", (this.onImage &&
|
||||||
|
@ -366,6 +370,7 @@ nsContextMenu.prototype = {
|
||||||
// Initialize contextual info.
|
// Initialize contextual info.
|
||||||
this.onImage = false;
|
this.onImage = false;
|
||||||
this.onLoadedImage = false;
|
this.onLoadedImage = false;
|
||||||
|
this.onCompletedImage = false;
|
||||||
this.onStandaloneImage = false;
|
this.onStandaloneImage = false;
|
||||||
this.onCanvas = false;
|
this.onCanvas = false;
|
||||||
this.onMetaDataItem = false;
|
this.onMetaDataItem = false;
|
||||||
|
@ -407,6 +412,8 @@ nsContextMenu.prototype = {
|
||||||
this.target.getRequest(Ci.nsIImageLoadingContent.CURRENT_REQUEST);
|
this.target.getRequest(Ci.nsIImageLoadingContent.CURRENT_REQUEST);
|
||||||
if (request && (request.imageStatus & request.STATUS_SIZE_AVAILABLE))
|
if (request && (request.imageStatus & request.STATUS_SIZE_AVAILABLE))
|
||||||
this.onLoadedImage = true;
|
this.onLoadedImage = true;
|
||||||
|
if (request && (request.imageStatus & request.STATUS_LOAD_COMPLETE))
|
||||||
|
this.onCompletedImage = true;
|
||||||
|
|
||||||
this.imageURL = this.target.currentURI.spec;
|
this.imageURL = this.target.currentURI.spec;
|
||||||
if (this.target.ownerDocument instanceof ImageDocument)
|
if (this.target.ownerDocument instanceof ImageDocument)
|
||||||
|
@ -590,6 +597,7 @@ nsContextMenu.prototype = {
|
||||||
this.onKeywordField = false;
|
this.onKeywordField = false;
|
||||||
this.onImage = false;
|
this.onImage = false;
|
||||||
this.onLoadedImage = false;
|
this.onLoadedImage = false;
|
||||||
|
this.onCompletedImage = false;
|
||||||
this.onMetaDataItem = false;
|
this.onMetaDataItem = false;
|
||||||
this.onMathML = false;
|
this.onMathML = false;
|
||||||
this.inFrame = false;
|
this.inFrame = false;
|
||||||
|
@ -719,6 +727,15 @@ nsContextMenu.prototype = {
|
||||||
BrowserPageInfo(this.target.ownerDocument);
|
BrowserPageInfo(this.target.ownerDocument);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
showImage: function(e) {
|
||||||
|
urlSecurityCheck(this.imageURL,
|
||||||
|
this.browser.contentPrincipal,
|
||||||
|
Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT);
|
||||||
|
|
||||||
|
if (this.target instanceof Ci.nsIImageLoadingContent)
|
||||||
|
this.target.forceReload();
|
||||||
|
},
|
||||||
|
|
||||||
// Change current window to the URL of the image.
|
// Change current window to the URL of the image.
|
||||||
viewImage: function(e) {
|
viewImage: function(e) {
|
||||||
var viewURL;
|
var viewURL;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче