W3C home > Mailing lists > Public > www-style@w3.org > January 2011

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

From: Simon Pieters <simonp@opera.com>
Date: Thu, 27 Jan 2011 06:52:06 +0100
To: "www-style@w3.org" <www-style@w3.org>
Cc: Philip Jägenstedt <philipj@opera.com>, "Leif Arne Storset" <lstorset@opera.com>, "Simon Fraser" <smfr@me.com>, "L. David Baron" <dbaron@dbaron.org>
Message-ID: <op.vpyc84k7idj3kv@simon-pieterss-macbook.local>
Hi

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).

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>.)

http://testsuites.opera.com/object-fit/README 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.

]]


On Thu, 18 Feb 2010 00:01:06 +0100, fantasai  
<fantasai.lists@inkedblade.net> wrote:

>> * New auto value
>>
>> WebKit, Gecko and Opera render SVG, bitmaps and videos differently in
>> <object>. Using any single value of image-fit would break this
>> compatibility. We suggest a new value auto that will maintain the status
>> quo.
>>
>> Suggestion: Under 10.2 The ‘image-fit’ Property, add "auto" to the list
>> of values. In the description, add the following:
>>
>> auto
>> Choose a method of scaling the content based on its type. The following
>> table gives the rendering for each type:
>>
>> Content | Scale as if image-fit:
>> --------+------------------------
>> bitmap | fill
>> SVG    | none
>> video  | contain
>
>
>> We found that for complete backwards-compatibility, image-position  
>> cannot
>> override preserveAspectRatio. Therefore we suggest to add the following
>> note in the description for the image-position property:
>>
>>     When rendering SVG with the property 'image-fit' set to 'auto',
>>     this property is ignored, and SVG's own preserveAspectRatio
>>     attribute will take effect instead.
>
> I'm not 100% clear on the interactions between SVG and the CSS-defined
> viewport here, so I'm not sure if this is correct. For one thing, if
> I specify 'image-position' on the <svg> element, and the SVG WG adopts
> image-fit and image-position as the property equivalents of the
> preserveAspectRatio attribute (which IIRC was the intent of the SVGWG
> at one point) that should work no problem.

http://lists.w3.org/Archives/Public/www-style/2010Feb/0165.html

-- 
Simon Pieters
Opera Software
Received on Thursday, 27 January 2011 05:52:48 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:36 GMT