Re: Resolution MQ and number of decimal points

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)

-- 
Simon Sapin

Received on Monday, 9 December 2013 00:44:31 UTC