Re: [css3-mediaqueries] feedback on device-aspect-ratio, aspect-ratio and orientation

On Fri, Oct 31, 2008 at 9:47 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:

> Tab Atkins Jr. wrote:
>
>>    Wouldn't that make it difficult (or impossible, since css3-values says
>>    numbers are reals rather than particular precision floats) to match
>> some
>>    aspect ratios like 4:3?  Wouldn't the author then be forced to write
>>    something like:
>>
>>     (min-aspect-ratio: 1.333) and (max-aspect-ratio: 1.334)
>>
>> Almost this exact discussion came up on the WHATWG list about <video>
>> aspect ratios.  ^_^  Ian has so far kept the aspect ratio a float.  His
>> argument is that the precision with which we store floats is *vastly*
>> greater than the differences between aspect ratios in use today or in the
>> relatively near future, and so the difference between a given ratio and the
>> closest-approximation float is irrelevant.
>>
>
> I'm not sure I follow...
>
> The use case at hand is to target 4:3 aspect ratios.  Since "aspect-ratio"
> would do an equality comparison, and since CSS uses decimals to represent
> real numbers, I would have to either do:
>
>  (aspect-ratio: 1.3333333333333333333)
>
> with the number of '3's depending on the precision of the floating-point
> numbers used by the UA (because if I don't have enough, the UA will treat
> that number as different from 4.0/3.0).  Since the precision is not defined
> anywhere, to get this to work I have to put in more digits than any UA might
> have.  That's a nasty requirement on content authors.   The very precision
> with which we store floating-point numbers is the problem here.
>
> The other option is to do what Cameron suggested and use something like:
>
>  (min-aspect-ratio: 1.333) and (max-aspect-ratio: 1.334)
>
> This does leverage your "differences between aspect ratios used today are
> small" idea, but is incredibly unintitive to author.  I see no reason we
> should force authors to do a nasty hack like this for what is likely a
> common use of this feature.
>
> With the current syntax, I just write:
>
>  (aspect-ratio: 4/3)
>
> and I'm done.


Hey, I'm just relaying Ian's arguments.  I think he assumes UAs as being
intelligent in figuring if a given ratio was 'close enough' to the float to
qualify as matching.

Relevant thread:
http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2008-October/thread.html#16588
http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2008-October/016588.html

~TJ

Received on Friday, 31 October 2008 14:57:28 UTC