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

[css3-images] Reintroduce object-fit: none

From: Leif Arne Storset <lstorset@opera.com>
Date: Wed, 26 Jan 2011 11:50:31 +0100
To: www-style@w3.org
Cc: Philip J├Ągenstedt <philipj@opera.com>, "Simon Pieters (zcorpan)" <simonp@opera.com>
Message-ID: <op.vpwwehoztmo5g6@nynorsk>
I was asked recently whether and why 'object-fit: none' was removed from  
the spec. Digging in the archives, it seems the proposal to keep/revive it  
was forgotten amid other issues. So this is a request to re-introduce  
'none' as a value for 'object-fit'. The definition would be "Render the  
content at its intrinsic dimensions, overflowing if necessary."

The use case is easy centering or positioning images without scaling them.  
Centering images vertically in a box can be a PITA today, especially if  
you don't know the dimensions. With image-fit:none, it is super-easy. Have  
a look at the attached demo (only supported in Opera 11, AFAIK).

(To avoid any confusion: There were objections to our proposal of another  
value, 'object-fit: auto', because the proposal was that behavior depend  
on content type. These issues do not affect the current proposal of  
'object-fit: none', since no content-type negotation takes place for  
'object-fit: none'.)

Some previous correspondence is quoted below.

Leif Arne Storset <lstorset@opera.com> skreiv Thu, 25 Feb 2010 17:09:03  
+0100

> Simon Pieters <simonp@opera.com> skreiv Thu, 18 Feb 2010 09:00:56 +0100
>
>> On Thu, 18 Feb 2010 00:01:06 +0100, fantasai  
>> <fantasai.lists@inkedblade.net> wrote:
>>
>>> On 01/21/2010 06:56 AM, Simon Pieters wrote:
>>>> Hi,
>>>>
>>>> Regarding image-fit and image-position:
>>>>
>>>> http://dev.w3.org/csswg/css3-page/#propdef-image-fit
>>>> http://dev.w3.org/csswg/css3-page/#propdef-image-posn
...
>>>> * Missing "none"
>>>>
>>>> The none value only seems to be documented in the example and is not
>>>> actually part of the property according to the current draft.
>>>>
>>>> Suggestion: In the image-fit definition, add "none" to the list of
>>>> values. In the description, add the following:
>>>>
>>>> none
>>>> Render the content at its intrinsic dimensions, overflowing if  
>>>> necessary.
>>>
>>> Hmm, the intention was to remove 'none', because we couldn't come up
>>> with a use case. Are you saying we should add it back?
>>
>> We've implemented it, and it seems useful for easy centering or  
>> positioning images without scaling them. Centering images vertically in  
>> a box can be a PITA today, especially if you don't know the dimensions.  
>> With image-fit:none, it is super-easy.
>
> The meeting minutes say that interpretation of the 'none' value depends  
> on the model for negotiation between box and content [2], and that Opera  
> Software asserted this value was necessary for SVG. I believe you may  
> have confused 'none' with 'auto' in this case, as the negotiation model  
> and SVG are important for 'auto' but not really for 'none'. Simon  
> Pieters's use case for 'none' was centering unscaled content in a large  
> box, something that is difficult now but trivial with 'image-fit: none'.
>
> Due to this confusion I suggest you reconsider the value 'none' at your  
> next meeting.
.
> [2] http://lists.w3.org/Archives/Public/www-style/2010Feb/0164.html

-- 
Leif Arne Storset
Core Technology Developer, Opera Software
Oslo, Norway


Received on Wednesday, 26 January 2011 10:50:49 GMT

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