Resolution MQ and number of decimal points

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?

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