W3C home > Mailing lists > Public > www-style@w3.org > December 2013

Re: Resolution MQ and number of decimal points

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 9 Dec 2013 16:35:43 +1100
Message-ID: <CAAWBYDCFjEJHED+LPgKqompvYjT-ApMFkTbXtzHNvBCQeYJp8Q@mail.gmail.com>
To: Simon Sapin <simon.sapin@exyr.org>
Cc: Yoav Weiss <yoav@yoav.ws>, www-style list <www-style@w3.org>
On Mon, Dec 9, 2013 at 11:44 AM, Simon Sapin <simon.sapin@exyr.org> wrote:
> On 08/12/2013 21:49, Yoav Weiss wrote:
>> When adding some new resolution MQ layout tests to Blink, I noticed that
>> current resolution MQs are compared as floats to devicePixelRatio.
>> That's seems to be true for Gecko as well.
>> Since devicePixelRatio is impacted by the page zoom level, it tends to
>> get fraction values in both Chrome & Firefox when zooming in/out.
>>
>> Comparing the resolution MQ value as a float to DPR often turns it (when
>> used without its min/max prefixes) to difficult to author and possibly
>> fragile (since the actual value may differ between platforms, sensitive
>> to implementation details, etc).
>> Just as an example, the matching resolution MQ in firefox on a
>> non-retina screen after 5 zoom-ins is (resolution: 1.7142857dppx)
>>
>> While the main use-case for using the resolution MQ to detect a zoom
>> level may be testing, IMO it makes sense to define the number of decimal
>> points the MQ needs to compare. I think that 2 or 3 decimal points
>> comparison is probably enough.
>>
>> Thoughts?
>
>
>
> Using un exact value such as (resolution: 1.7142857dppx) or even
> (resolution: 2dppx) seems like a bad idea as it only matches in a very
> narrow set of conditions.
>
> It’s better to use ranges such as (min-resolution: 1.5dppx)

Yeah, we don't define the precision of these things, and beyond maybe
a required minimum precision (which we tried in V&U and didn't finish
in time for V&U3), we don't *want* to define the precision.  Browsers
should be allowed to be as precise or as unprecise as they feel is
appropriate and acceptable.

The resolution MQ should be used with a range, which'll get easier to
specify when browsers support the new syntax:

(1.5dppx < resolution <= 2.5dppx)

~TJ
Received on Monday, 9 December 2013 05:36:30 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:17 UTC