Bug 155062. View background image fails/works incorrectly when things have a background attribute, but a different specified style. We should always get the computed background-image and ignore what
the background attribute says. r=bzbarsky sr=blake git-svn-id: svn://10.0.0.236/trunk@205675 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
13f0f1f2e3
commit
7d0dcf53e5
@ -277,12 +277,11 @@ nsContextMenu.prototype = {
|
||||
// pages with multiple <body>s are lame. we'll teach them a lesson.
|
||||
var bodyElt = this.target.ownerDocument.getElementsByTagName("body")[0];
|
||||
if ( bodyElt ) {
|
||||
var attr = bodyElt.getAttribute( "background" );
|
||||
if ( attr ||
|
||||
( attr = this.getComputedURL( bodyElt, "background-image" ) ) ) {
|
||||
var computedURL = this.getComputedURL( bodyElt, "background-image" );
|
||||
if ( computedURL ) {
|
||||
this.hasBGImage = true;
|
||||
this.bgImageURL = this.makeURLAbsolute( bodyElt.baseURI,
|
||||
attr );
|
||||
computedURL );
|
||||
}
|
||||
}
|
||||
} else if ( "HTTPIndex" in _content &&
|
||||
@ -382,17 +381,16 @@ nsContextMenu.prototype = {
|
||||
}
|
||||
}
|
||||
|
||||
// Background image? We don't bother if we've already found a background
|
||||
// image further down the hierarchy. Otherwise, we look for background=
|
||||
// attribute on html elements that support that, or, background-image style.
|
||||
var bgImgUrl = null;
|
||||
if ( !this.hasBGImage &&
|
||||
( ( localname.search( /^(?:TD|TH|TABLE|BODY)$/ ) != -1 &&
|
||||
( bgImgUrl = elem.getAttribute( "background" ) ) ) ||
|
||||
( bgImgUrl = this.getComputedURL( elem, "background-image" ) ) ) ) {
|
||||
this.hasBGImage = true;
|
||||
this.bgImageURL = this.makeURLAbsolute( elem.baseURI,
|
||||
bgImgUrl );
|
||||
// Background image? Don't bother if we've already found a
|
||||
// background image further down the hierarchy. Otherwise,
|
||||
// we look for the computed background-image style.
|
||||
if ( !this.hasBGImage ) {
|
||||
var bgImgUrl = this.getComputedURL( elem, "background-image" );
|
||||
if ( bgImgUrl ) {
|
||||
this.hasBGImage = true;
|
||||
this.bgImageURL = this.makeURLAbsolute( elem.baseURI,
|
||||
bgImgUrl );
|
||||
}
|
||||
}
|
||||
}
|
||||
elem = elem.parentNode;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user