bug 229441: Background images are not shown in Media tab (Page Info)

patch by Florian QUEZE <f.qu@laposte.net>, r=db48x, sr=jag
This commit is contained in:
db48x%yahoo.com 2006-09-14 06:09:14 +00:00
Родитель beb03a1515
Коммит 629e0a078f
1 изменённых файлов: 17 добавлений и 5 удалений

Просмотреть файл

@ -23,6 +23,7 @@
* smorrison@gte.com
* Terry Hayes <thayes@netscape.com>
* Daniel Brooks <db48x@yahoo.com>
* Florian QUEZE <f.qu@laposte.net>
*
* 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
{