W3C home > Mailing lists > Public > www-style@w3.org > February 2012

[css3-images] Probably editorial: 'object-fit' values 'cover' and 'contain' contain redundant definition

From: Leif Arne Storset <lstorset@opera.com>
Date: Wed, 01 Feb 2012 16:07:58 +0100
To: "www-style@w3.org" <www-style@w3.org>
Message-ID: <op.v8z9nkqetmo5g6@localhost.localdomain>
In section 5.4, both 'contain' and 'cover' seem to be defined twice. For
example, 'contain' says

| Determine the used ‘height’ and ‘width’ of the element as usual, except:
| If both ‘height’ and ‘width’ are ‘auto’, and the used value of at least
| one of ‘max-width’ and ‘max-height’ is not ‘none’, then compute the
| element's used width and used height as though the intrinsic dimensions
| of the contents were infinitely large numbers whose ratio is the actual
| intrinsic ratio of the contents. This will proportionally scale the used
| width and height up to the given maximum constraints.
|
| Set the concrete object size to the largest width and height that has
| the same aspect ratio as the object's intrinsic aspect ratio, and
| additionally has neither width nor height larger than the replaced
| element's used width and height, respectively.

These seem redundant to me. I suspect the first definition, written in
2007, hails from a time when '(max|min)-(width|height)' were underdefined
in level 2, and "as usual" wasn't sufficient. [0] Determining used values
for 'width' and 'height' seems out of scope for this property and this
spec, as implied by the introduction to 5.4:

| The ‘object-fit’ property specifies how the contents of a replaced
| element should be scaled relative to the box established by its used
| height and width.

I could be wrong: my head is spinning from trying to calculate
some examples according to both the specs. If I am wrong, and some
situation does require all the infinity math, I feel we could phrase it
more simply and/or state the covered cases more clearly.

My primary suggestion, however, is to delete the first paragraph, both
under 'contain' and 'cover', so that both consist only of a paragraph
starting with "Set the concrete object size…".

[0] At the moment I can't find old versions of CSS 2.1, but CSS 2 does not
define it as well as CSS 2.1.
CSS 2:  
http://www.w3.org/TR/2008/REC-CSS2-20080411/visudet.html#min-max-widths
CSS 2.1: http://www.w3.org/TR/CSS21/visudet.html#min-max-widths

-- 
Leif Arne Storset
Core Technology Developer, Opera Software
Oslo, Norway
Received on Wednesday, 1 February 2012 15:08:27 GMT

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