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
This commit is contained in:
law%netscape.com
1999-11-22 23:04:34 +00:00
parent 7011fe7fc1
commit 2422c0617b

View File

@@ -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 () {