Closed Bug 410502 Opened 18 years ago Closed 18 years ago

Page Info should show SVG images as images

Categories

(SeaMonkey :: Page Info, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: longsonr, Assigned: longsonr)

References

()

Details

Attachments

(1 file, 2 obsolete files)

Attached patch patch (obsolete) — Splinter Review
Also Xlinks are not resolved properly as the conversion from href to absolute url always fails since it uses an undefined variable. http://www.w3schools.com/svg/a_1.svg has an XLink in to test this. See bug 315010 and bug 409310 for the firefox version of this patch.
Attachment #295112 - Flags: review?(db48x)
Summary: SVG images do not display as images → Page Info should show SVG images as images
Comment on attachment 295112 [details] [diff] [review] patch >@@ -578,19 +578,22 @@ function grabAll(elem) > addImage(elem.src, gStrings.mediaEmbed, "", elem, false); > else if (elem.hasAttributeNS(XLinkNS, "href")) > { > var ioService = Components.classes["@mozilla.org/network/io-service;1"] > .getService(Components.interfaces.nsIIOService); > url = elem.getAttributeNS(XLinkNS, "href"); > try { > var baseURI = ioService.newURI(elem.baseURI, elem.ownerDocument.characterSet, null); >- url = ioService.newURI(href, elem.ownerDocument.characterSet, baseURI).spec; >+ url = ioService.newURI(url, elem.ownerDocument.characterSet, baseURI).spec; > } catch (e) {} >- gLinkView.addRow([getValueText(elem), url, gStrings.linkX, ""]); >+ if (elem instanceof SVGImageElement) >+ addImage(url, gStrings.mediaImg, "", elem, false); >+ else >+ gLinkView.addRow([getValueText(elem), url, gStrings.linkX, ""]); The way you have this, svg images will only show up if they are also xlinks. Is that intentional?
Attachment #295112 - Flags: review?(db48x) → review-
This is an example SVG image... <svg> <image x="200" y="200" width="100px" height="100px" xlink:href="myimage.png"> </svg> So the code does think it is an xlink at the moment. If the xlink attribute is missing then we have no image to show. So yes it was intentional.
What would you like me to do Daniel?
Ah, hrm. I hadn't realized that it worked that way. What's supposed to happen if there is an image tag without an xlink?
That would be an error, the upshot of which would be that the page would be rendered as if the image did not exist.
Comment on attachment 295112 [details] [diff] [review] patch In that case, r=db48x
Attachment #295112 - Flags: review- → review+
Actually, add a comment about the images needing an xlink in order to count before you check it in.
Attached patch address review comment (obsolete) — Splinter Review
Attachment #295112 - Attachment is obsolete: true
Attachment #296987 - Flags: superreview?(neil)
Comment on attachment 296987 [details] [diff] [review] address review comment >+ if (item instanceof SVGImageElement) { >+ setItemValue("imagetitletext", null); >+ setItemValue("imagelongdesctext", null); >+ setItemValue("imagealttext", null); >+ } I don't like the way you override the values here. I'd prefer it if you added extra conditions to the cases above to set the values appropriately for SVG. > if ((item instanceof HTMLLinkElement || item instanceof HTMLInputElement || > item instanceof HTMLImageElement || >+ item instanceof SVGImageElement || If you make my other changes then could you also neaten this up; I guess each item on its own line would be best. >+ if (item instanceof SVGImageElement) { >+ newImage.width = item.width.baseVal.value; >+ newImage.height = item.height.baseVal.value; >+ } Again, I feel it would be best with this before the previous condition (with an else in between of course).
Attachment #296987 - Flags: superreview?(neil) → superreview+
address sr comments
Attachment #296987 - Attachment is obsolete: true
checked in
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Depends on: 481509
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: