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

At 01:15 PM 5/9/2005, Boris Zbarsky wrote:

>I have a question about the sizing of outermost <svg> elements.
>In section 7.2 [1], the specification says:
>   The width attribute on the 'svg' element establishes the viewport's
>   width, unless 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 containing document;
>     * and the referencing element or containing document is styled
>       using CSS [CSS2] or XSL [XSL];
>     * and there are CSS-compatible positioning properties [ CSS2-POSN]
>       specified on the referencing element (e.g., the 'object' element)
>       or on the containing document's 'svg' element that are sufficient
>       to establish the width of the viewport.
>Here "[CSS2-POSN]" is a link to the Visual Formatting Model chapter 
>(chapter 9) of CSS2.  Unfortunately, the "width" property in CSS2 is in 
>the "Visual formatting model details" chapter (chapter 10).

Thanks for pointing this out. This incorrect reference has been in the SVG 
spec forever. The guy who edited the SVG 1.0 spec screwed up. (Guess who 
that was.) I believe the correct reference should be to chapter 10, as you 

>This leaves me unsure as to whether an outermost <svg:svg> element in an 
>XHTML document styled with "width: 100px" and having width="50px" as an 
>attribute should be 100px wide or 50px wide.  I'm assuming the intent is 
>that it should be the former, right?  It may be worth adjusting the text 
>to make that clearer.

Yes, the former.

>Further, there is the question of interaction with the CSS display 
>property, since per CSS width/height do not apply to display:inline 
>non-replaced elements.  I guess the intention is that <svg:svg> should 
>essentially be a replaced element in CSS terms?  That is, with the default 
>display value of "inline" the specified values of width and height should 
>affect the computed width and height?  That would make some sense to me, 
>since a CSS renderer can't really do anything with an <svg:svg> other than 
>reserve space for its desired size in the CSS box model...

Yes, that makes sense to me: compute the width/height of an inline svg:svg 
element following the rules for CSS inline, replaced elements.



Received on Tuesday, 10 May 2005 14:22:12 UTC