The problem is that Firefox does *not* show SVG images with <html:img>,
<xul:image>, <button image="">, CSS background-image, etc. Strangely, it
shows the SVG images if the image URL is put in the address bar.
Am I wrong in expecting Firefox to treat a SVG file like an image?
Next are two minimal test cases, one in HTML and the other in XUL. As a side
note, Opera shows the SVG image in the HTML test case.
=====================================
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<button image="image.svg" label="test" /> <!-- NO IMAGE -->
<image src="image.svg"/> <!-- NO IMAGE -->
<button image="image.png" label="test" /> <!-- SHOWS IMAGE -->
<image src="image.png"/> <!-- SHOWS IMAGE -->
</window>
=====================================
=====================================
<html>
<head><title></title></head>
<body>
<img src="image.svg" /> <!-- NO IMAGE -->
<img src="image.png" /> <!-- SHOWS IMAGE -->
</body>
</html>
=====================================
Correct.
> Strangely, it shows the SVG images if the image URL is put in the address bar.
Or in an iframe, or <object>. We treat SVG as documents, not images.
> Am I wrong in expecting Firefox to treat a SVG file like an image?
No; it's just not implemented yet. Note that when it is SVG images and
SVG documents won't have quite the same behavior.
-Boris
SVG file being handled like an image is what I expect when using <html:img>,
<xul:image>, CSS/background-image, etc. I would expect this to be easier to
implement than SVG as a document, especially since SVG drawing is already
in Firefox. When an image is what is expected just convert SVG to a
properly sized bitmap and be done with it.
Regards.
That would actually give the wrong behavior, so no, we don't plan to do
that.
-Boris
I'm curious, what is the right behavior? I looked for Mozilla SVG plans but
the most recent I found was a few years old. Can you point me to up to date
Mozilla SVG plans?
Regards.
Scaling as a vector image when scaled, for example.
> I looked for Mozilla SVG plans but the most recent I found was a few years old. Can you point me to up to date
> Mozilla SVG plans?
No idea. If you search in bugzilla you can find the bug on supporting
SVG in <html:img>, though.
-Boris