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

Resolution MQ and number of decimal points

From: Yoav Weiss <yoav@yoav.ws>
Date: Sun, 8 Dec 2013 22:49:51 +0100
Message-ID: <CACj=BEiweis6YG4mWVcFmd+ogz9Mo=ORk+cjf7G52K+EpQGnhw@mail.gmail.com>
To: www-style list <www-style@w3.org>
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.

Received on Sunday, 8 December 2013 21:50:19 UTC

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