Re: [SVGT 1.2] Question on sizing of the outermost <svg>

Jon Ferraiolo wrote:
>     * the SVG content is a separately stored resource that is embedded
> by reference (such as the 'object' element in [XHTML]), or the SVG
> content is embedded inline within a parent document;
>     * the parent document is styled using CSS [CSS2] or XSL [XSL];

Those two are good.

>     * CSS-compatible width properties [see CSS2-VISUDET] or
> corresponding XSL properties are specified on the referencing element
> (or rootmost 'svg' element for inline SVG content).

This one is not as good, I think.  For example, say I have:

   <svg:svg style="height: 100px" width="50" height="50"/>

In this case, the viewport will be 50px wide and 100px tall per the spec 
as written, whereas I think it's pretty clear that rendering it 100px 
wide by 100px tall would be vastly preferable in this case (this is how 
HTML images work, for example -- if only one dimension is specified, 
they're scaled in a way that preserves the aspect ratio).

I don't know enough about XSL to hazard a wording that works for it, but 
here's what I'd suggest as possible wording for working well with CSS 
(it's rough, especially in trying to handle both inline and by-reference 
cases at the same time and tersely and in using the term 'rootmost' to 
mean 'rootmost in the document fragment we care about', but I'm just 
trying to get the idea across):

--------------------------------------------------------------
If both of the following conditions are met:

   * The SVG content is a separately stored resource that is embedded
by reference (such as the 'object' element in [XHTML]), or the SVG
content is embedded inline within a parent document;
   * the parent document is styled using CSS [CSS2]

Then the dimensions of the viewport are determined as follows:

1) Let the "referencing element" be the element embedding the SVG by 
reference or the rootmost 'svg' element if the SVG is inline.
2) Set the dimensions of the viewport to the dimensions of the CSS box 
generated by the referencing element.  These should be found by using 
the CSS algorithm for replaced elements for the relevant display type, 
even if the SVG is included inline.  For purposes of this step, the 
intrinsic width and height of the SVG content are given by the width and 
height attributes of the rootmost 'svg' element.
--------------------------------------------------------------

If there is a way for SVG to specify an aspect ratio but not a 
width/height, then step 2 should mention it.

There is an outstanding problem with this, which is that it's
not clear what happens with percentage values for width/height on <svg>. 
  I know that's been brought up before, but I don't recall what the 
outcome of that discussion was...

-Boris

Received on Tuesday, 1 November 2005 22:58:21 UTC