Re: [css3-images] min/max-width/height wording in sizing rules for object-fit: contain/cover

On Wed, Mar 14, 2012 at 2:42 PM, L. David Baron <dbaron@dbaron.org> wrote:
> http://dev.w3.org/csswg/css3-images/#object-fit (5.4, Sizing
> Objects: the ‘object-fit’ property) says in the definition of
> 'contain':
>  # 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.
> and then in the definition of 'cover' it 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 ‘min-width’ and ‘min-height’ is not
>  # ‘none’, then compute the element's used width and used height as
>  # though the intrinsic dimensions of the contents were infinitely
>  # small numbers whose ratio is the actual intrinsic ratio of the
>  # contents. This will proportionally scale the used width and
>  # height down to the given minimum constraints.
>
> For a start, as far as I'm aware, min/max-width/height don't have
> used values; they only influence the used values of width and
> height.

All properties have used values.  min/max-width/height, in particular,
sometimes need to wait until used-value time to compute anyway, such
as if their value is a percentage and the containing block doesn't
have a definite size in that dimension.


> More importantly, the statement under 'contain' (where it deals with
> max-*) is incorrect, since min-* override max-*, so if an element
> with object-fit: contain has min-* set and hits the case mentioned
> above, the final sentence quoted above won't hold.  However, if a
> value of max-* that's been adjusted by any larger min-* is used,
> then I believe it will hold.
>
> It's also not clear to me when these statements cause the behavior
> to change.  Perhaps the spec should explain that?

Whether or not to even preserve the behavior switch implied by these
properties is one of the issues the WG needs to decide on.  I think we
should drop that behavior, in which case these problems are moot.

~TJ

Received on Wednesday, 14 March 2012 21:51:45 UTC