Overriding the width and height of SVG

Hi all,

In Firefox 3, dimensioning of SVG is going to be much improved. As part of the
improvements we implemented the overriding behavior specified at:

  http://www.w3.org/TR/SVG11/coords.html#ViewportSpace

So far the only complaint we've had about the change in behavior is along the
lines of "my SVG is being clipped instead of scrolling!". What appears to be
clipping is happening because the width and height of the embedded SVG is being
overridden by the width and height of the embedding element, but the SVG doesn't
scale if it doesn't have a viewBox.

If the author's intent is to have their SVG scale then they can and should
specify a viewBox of course. However, people are sometimes going to get this
wrong, and it would be nice to be able to control the behavior from the HTML
side if the SVG is outwith your control (and perhaps comes from a different
domain, which prevents you "fixing up" the SVG by setting a viewBox from script).

This will all come too late for Firefox 3, but it would be good to think about
nevertheless. Perhaps we should only do the overriding thing if the SVG actually
has a viewBox specified? Is there a way to control the behavior [with spec
additions] using CSS?

Something to think about.

Regards,
Jonathan

Received on Thursday, 13 March 2008 07:18:00 UTC