mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
Bug 315010 - Page Info should list links and images in SVG page. r=me, a=mconnor.
This commit is contained in:
parent
17932e8f71
commit
650f4b3282
@ -4357,16 +4357,6 @@ function middleMousePaste(event)
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
function makeURLAbsolute( base, url )
|
||||
{
|
||||
// Construct nsIURL.
|
||||
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var baseURI = ioService.newURI(base, null, null);
|
||||
|
||||
return ioService.newURI(baseURI.resolve(url), null, null).spec;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note that most of this routine has been moved into C++ in order to
|
||||
* be available for all <browser> tags as well as gecko embedding. See
|
||||
|
@ -609,6 +609,12 @@ function grabAll(elem)
|
||||
if (elem instanceof HTMLImageElement)
|
||||
addImage(elem.src, gStrings.mediaImg,
|
||||
(elem.hasAttribute("alt")) ? elem.alt : gStrings.notSet, elem, false);
|
||||
#ifdef MOZ_SVG
|
||||
else if (elem instanceof SVGImageElement) {
|
||||
var href = makeURLAbsolute(elem.baseURI, elem.href.baseVal);
|
||||
addImage(href, gStrings.mediaImg, "", elem, false);
|
||||
}
|
||||
#endif
|
||||
else if (elem instanceof HTMLLinkElement) {
|
||||
if (elem.rel && /\bicon\b/i.test(elem.rel))
|
||||
addImage(elem.href, gStrings.mediaLink, "", elem, false);
|
||||
@ -837,6 +843,14 @@ function makePreview(row)
|
||||
else
|
||||
setItemValue("imagealttext", getValueText(item));
|
||||
|
||||
#ifdef MOZ_SVG
|
||||
if (item instanceof SVGImageElement) {
|
||||
setItemValue("imagetitletext", null);
|
||||
setItemValue("imagelongdesctext", null);
|
||||
setItemValue("imagealttext", null);
|
||||
}
|
||||
#endif
|
||||
|
||||
// get cache info
|
||||
var sourceText = gBundle.getString("generalNotCached");
|
||||
var cacheKey = url.replace(/#.*$/, "");
|
||||
@ -913,6 +927,9 @@ function makePreview(row)
|
||||
|
||||
if ((item instanceof HTMLLinkElement || item instanceof HTMLInputElement ||
|
||||
item instanceof HTMLImageElement ||
|
||||
#ifdef MOZ_SVG
|
||||
item instanceof SVGImageElement ||
|
||||
#endif
|
||||
(item instanceof HTMLObjectElement && /^image\//.test(mimeType)) || isBG) && isProtocolAllowed) {
|
||||
newImage.setAttribute("src", url);
|
||||
physWidth = newImage.width || 0;
|
||||
@ -926,12 +943,19 @@ function makePreview(row)
|
||||
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
|
||||
// the Width and Height of an HTML tag should not be used for its background image
|
||||
// (for example, "table" can have "width" or "height" attributes)
|
||||
newImage.width = newImage.naturalWidth;
|
||||
newImage.height = newImage.naturalHeight;
|
||||
}
|
||||
|
||||
#ifdef MOZ_SVG
|
||||
if (item instanceof SVGImageElement) {
|
||||
newImage.width = item.width.baseVal.value;
|
||||
newImage.height = item.height.baseVal.value;
|
||||
}
|
||||
#endif
|
||||
|
||||
width = newImage.width;
|
||||
height = newImage.height;
|
||||
|
||||
|
@ -495,6 +495,11 @@ function isElementVisible(aElement)
|
||||
return (bo.height > 0 && bo.width > 0);
|
||||
}
|
||||
|
||||
function makeURLAbsolute(aBase, aUrl)
|
||||
{
|
||||
return IO.newURI(IO.newURI(aBase).resolve(aUrl)).spec;
|
||||
}
|
||||
|
||||
function getBrowserFromContentWindow(aContentWindow)
|
||||
{
|
||||
var browsers = gBrowser.browsers;
|
||||
|
Loading…
Reference in New Issue
Block a user