diff --git a/suite/browser/pageInfo.js b/suite/browser/pageInfo.js index c9f88fa92348..523492a8bd10 100644 --- a/suite/browser/pageInfo.js +++ b/suite/browser/pageInfo.js @@ -23,6 +23,7 @@ * smorrison@gte.com * Terry Hayes * Daniel Brooks + * Florian QUEZE * * Alternatively, the contents of this file may be used under the terms of * either of the GNU General Public License Version 2 or later (the "GPL"), @@ -880,16 +881,27 @@ function makePreview(row) var physWidth = 0, physHeight = 0; if ((item instanceof nsILinkElement || item instanceof nsIInputElement || - item instanceof nsIImageElement || isBG) && isProtocolAllowed) + item instanceof nsIImageElement || isBG) && isProtocolAllowed) { newImage.src = absoluteURL; physWidth = newImage.width; physHeight = newImage.height; - if ("width" in item && item.width) - newImage.width = item.width; - if ("height" in item && item.height) - newImage.height = item.height; + // "width" and "height" attributes must be set to newImage, + // even if there is no "width" or "height attribute in item; + // otherwise, the preview image cannot be displayed correctly. + if (!isBG) + { + newImage.width = ("width" in item && item.width) || newImage.naturalWidth; + newImage.height = ("height" in item && item.height) || newImage.naturalHeight; + } + else + { + // the Width and Height of an HTML tag should not be use for its background image + // (for example, "table" can have "width" or "height" attributes) + newImage.width = newImage.naturalWidth; + newImage.height = newImage.naturalHeight; + } } else {