From 2422c0617b2891cf7426ca855aaefc55c3053305 Mon Sep 17 00:00:00 2001 From: "law%netscape.com" Date: Mon, 22 Nov 1999 23:04:34 +0000 Subject: [PATCH] Fix for 18763; submitted by Steve Morrison (smorrison@gte.com); r=law@netscape.com git-svn-id: svn://10.0.0.236/trunk@54203 18797224-902f-48f8-a5cc-f745e15eee43 --- .../resources/content/nsContextMenu.js | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/mozilla/xpfe/browser/resources/content/nsContextMenu.js b/mozilla/xpfe/browser/resources/content/nsContextMenu.js index fa341e24522..d3db76ab2b2 100644 --- a/mozilla/xpfe/browser/resources/content/nsContextMenu.js +++ b/mozilla/xpfe/browser/resources/content/nsContextMenu.js @@ -143,6 +143,7 @@ nsContextMenu.prototype = { setTarget : function ( node ) { // Initialize contextual info. this.onImage = false; + this.imageURL = ""; this.onLink = false; this.inFrame = false; this.hasBGImage = false; @@ -154,6 +155,7 @@ nsContextMenu.prototype = { if ( this.target.nodeType == 1 ) { if ( this.target.tagName.toUpperCase() == "IMG" ) { this.onImage = true; + this.imageURL = this.target.src; // Look for image map. var mapName = this.target.getAttribute( "usemap" ); if ( mapName ) { @@ -193,7 +195,25 @@ nsContextMenu.prototype = { } } } - } + } else if (this.target.tagName.toUpperCase() == "INPUT") { + if(this.target.getAttribute( "type" ).toUpperCase() == "IMAGE") { + this.onImage = true; + this.imageURL = this.target.src; + } + } else if (this.target.getAttribute( "background" )) { + this.onImage = true; + this.imageURL = this.target.getAttribute( "background" ); + } else { + var cssAttr = this.target.style.getPropertyValue( "list-style-image" ) || + this.target.style.getPropertyValue( "list-style" ) || + this.target.style.getPropertyValue( "background-image" ) || + this.target.style.getPropertyValue( "background" ); + if ( cssAttr ) { + this.onImage = true; + this.imageURL = cssAttr.toLowerCase().replace(/url\("*(.+)"*\)/, "$1"); + } + } + } // See if the user clicked in a frame. @@ -246,7 +266,7 @@ nsContextMenu.prototype = { }, // Open new window with the URL of the image. viewImage : function () { - openNewWindowWith( this.target.src ); + openNewWindowWith( this.imageURL ); }, // Save URL of clicked-on frame. saveFrame : function () {