Re: absolute-replaced-width-016/017/018 incorrect

On 10/14/10 1:01 AM, Alan Gresley wrote:
> Correct, SVG covers 100% of the viewport when no height or width is
> specified but only if it is just a svg document with a svg extension (no
> (x)html). I didn't know that it was default behavior.

http://www.w3.org/TR/SVG/struct.html#SVGElementWidthAttribute says:

   If the attribute is not specified, the effect is as if a value of
   '100%' were specified.

and similar for height.

> Yes if you think this is correct.
>
> <http://css-class.com/test/svg/background-position2.xml>

So in this case the intrinsic width of the <svg> is 100% and the 
intrinsic height is also 100%, right?  It also has no intrinsic ratio.

Then per CSS 2.1 section 10.3.2 its intrinsic width is 100% of the 
containing block width, and since height and width are styled auto that 
becomes the used value for width.

Per CSS 2.1 section 10.6.2 the percentage intrinsic height is ignored 
(because the parent is auto height).  So this rule in 10.6.2 applies: 
"the used value of 'height' must be set to the height of the largest 
rectangle that has a 2:1 ratio, has a height not greater than 150px, and 
has a width not greater than the device width".

So the net result is the <svg> ends up the width of the viewport and 
150px high.

> I don't know why it's has that height

See above.

> or why the polyline is clipped.

http://www.w3.org/TR/SVG/styling.html#UAStyleSheet says:

   svg, symbol, image, marker, pattern, foreignObject {
     overflow: hidden
   }

> Opera 10.62 shows the same as Gecko.

Yep.

> IE9 does not clip the blue polyline

That's a known IE9 bug with SVG, as far as I can tell.  Certainly I've 
reported it before....

> but the red border is the same height.

Right, as required by CSS 2.1 section 10.6.2.

> Safari seems to show it correct with no clipping.

For some definitions of "correct" that don't match the current CSS 2.1 
text...

-Boris

Received on Thursday, 14 October 2010 05:48:04 UTC