Re: [css3-images] Reconsider 'auto' value for object-fit

On Jan 26, 2011, at 9:52 pm, Simon Pieters wrote:

> I'd like the WG to reconsider the 'auto' value that we suggested as the initial value for object-fit back when we implemented object-fit. It's needed to retain backwards compatibility with traditional behavior of bitmaps and SVG in <img> and <object> as well as inline <svg>. I'm particularly interested in whether WebKit and Gecko would like to keep the status quo behavior for bitmaps and SVG in <img> and <object> (and <svg>) by using 'auto' or would rather like to change from the traditional behavior and make 'fill' the default, as the spec says (and probably breaking Web content that expects the traditional behavior, as well as changing from what the SVG spec requires for SVG, IIRC).

Can you be more specific about the cases where behavior would change by having the default be 'fill'? Is it just the case of SVG with preserveAspectRatio, as noted below? It would be good to see some testcases here.

It also interacts with CSS 2.1 behavior for replaced elements with intrinsic aspect ratio, so it's a tricky area.

> At this time I don't recall exactly how the SVG spec ended up with interaction with object-fit, if at all. However, we implemented 'auto' as the initial value for object-fit as we suggested back then. (We made 'auto' map to 'contain' for video because back then we planned to make Ogg work in <object> something like as if it was <video controls>. We've dropped that plan but still make 'auto' map to 'contain' for <video>.)

For this case, you could set video { object-fit: contain; } in your UA CSS file, no?

> has an up-to-date description of our 'auto' value, quoted below:
> [[
> auto
>    The initial value. Is used to retain backwards compatibility -- traditionally bitmaps and SVG
>    render differently in <object>, so to remain the status quo, a new value was needed.
>    Choose a method of scaling the content based on its type and element. The following table gives
>    the rendering for each type:
>    Content         | Used value
>    ----------------+---------------------------------------------------------------------
>    bitmap          | -o-object-fit: fill
>    ----------------+---------------------------------------------------------------------
>    SVG in <img>    | synthesize a viewbox if none is specified (if possible ) and respect
>                    | preserveAspectRatio
>    ----------------+---------------------------------------------------------------------
>    SVG in <object> | if a viewbox is provided, respect preserveAspectRatio; otherwise,
>    or <svg> 	    | -o-object-fit: none; -o-object-position: top left
>    ----------------+---------------------------------------------------------------------
>    video           | -o-object-fit: contain
>    Viewbox synthesis is not possible when SVG width and height are specified as percentages.
>    When rendering SVG with the property -o-object-fit set to 'auto', the -o-object-position
>    property is ignored, and SVG's own preserveAspectRatio attribute will take effect instead.
> ]]


Received on Thursday, 27 January 2011 06:13:13 UTC