Re: [css-sizing] default object size for intrinsic sizes of replaced elements

On Tue, Jan 26, 2016 at 1:39 AM, David Vest <davve@opera.com> wrote:
> https://drafts.csswg.org/css-sizing-3/#replaced-intrinsic says:
>
>   For replaced elements, the min-content size and max-content size are
>   equivalent and correspond to the appropriate dimension of the
>   concrete object size returned by the default sizing algorithm
>   [CSS3-IMAGES] of the element, calculated with an unconstrained
>   specified size.
>
> It doesn't say what's the default object size should be in this
> case. If it would be the standard 300x150 fallback I fear the svg
> would pop out to 300px in something like:
>
> <!DOCTYPE html>
> <style>
>     div { width: 100px }
> </style>
> <div><svg viewBox="0 0 1 1"></svg></div>
>
> Other options?

Inline SVG counts as a replaced element for the layout algorithm;
<https://drafts.csswg.org/css-images/#object-sizing-examples> says
that the sizing of replaced elements are defined in 2.1. In
particular, this is defined in
<https://www.w3.org/TR/CSS21/visudet.html#inline-replaced-width>
(section 10.3.2, the first link in the replaced elements example in
Images).  This case is technically undefined (browsers were
inconsistent at the time we were finalizing 2.1), but the suggestion
is that replaced elements with an aspect ratio "act like blocks" (more
or less) to determine their width, and the height is calculated from
that and the aspect ratio.

(If it didn't have a viewBox to give it an aspect ratio, it would
indeed default to 300x150, as defined in the places I talk about
above.)

~TJ

Received on Tuesday, 26 January 2016 19:49:46 UTC