Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SVG image not shown by Firefox

529 views
Skip to first unread message

Lusotec

unread,
Feb 25, 2009, 1:43:08 PM2/25/09
to
I'm developing a remote XUL application and it is mostly done. I'm now in
the beautifying phase and would like to use SVG images.

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>
=====================================


Boris Zbarsky

unread,
Feb 25, 2009, 2:11:14 PM2/25/09
to
Lusotec wrote:
> The problem is that Firefox does *not* show SVG images with <html:img>,
> <xul:image>, <button image="">, CSS background-image, etc

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

Lusotec

unread,
Feb 25, 2009, 2:18:54 PM2/25/09
to
Boris Zbarsky wrote:

> Lusotec wrote:
>> 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.

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.

Boris Zbarsky

unread,
Feb 25, 2009, 2:40:28 PM2/25/09
to
Lusotec wrote:
> When an image is what is expected just convert SVG to a
> properly sized bitmap and be done with it.

That would actually give the wrong behavior, so no, we don't plan to do
that.

-Boris

Lusotec

unread,
Feb 25, 2009, 3:08:32 PM2/25/09
to

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.

Boris Zbarsky

unread,
Feb 25, 2009, 3:20:25 PM2/25/09
to
Lusotec wrote:
> Boris Zbarsky wrote:
>> Lusotec wrote:
>>> When an image is what is expected just convert SVG to a
>>> properly sized bitmap and be done with it.
>> That would actually give the wrong behavior, so no, we don't plan to do
>> that.
>
> I'm curious, what is the right behavior?

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

0 new messages