[css3-mediaqueries] Rounding

Today we discussed how imprecision in device hardware results in
display widths and heights that are not *exactly* in line with the
nominal width and height. It was suggested that we should allow
some fuzz factor in media query matching for this reason. Therefore
I propose adding the following text to the spec:

(I included rules for 'aspect-ratio' in case we add them.)

Fuzzy Matching
--------------

   Because devices are often not *exactly* their nominal size, this
   spec allows inexact matches as follows:

     * The UA should use the device's nominal width, height, and/or
       aspect ratio instead of its actual width/height/aspect ratio
       when matching the device-*, min-device-*, and max-device-*
       media queries, if such information is available.
     * The UA may match the 'resolution', 'width', and 'height'
       media queries (but not the min-* or max-* variations on these
       media queries) within 5% error.
     * The UA may match the 'aspect-ratio' media query within 5%
       error, where the error check is applied independently to the
       numerator and denominator.
     * For 'min-aspect-ratio' and 'max-aspect-ratio', if the actual
       aspect ratio is between 1/12 and 12/1 then the UA may round
       the actual aspect ratio to the nearest of:
         * the nominal ratio of any paper size listed in tables 3-8
           of [PWGMSN] in either portrait or landscape orientation
         * any ratio {1..(2N-1)}/N where N ∈ {1..12}[1]
         * the inverse of the above
       before matching against the specified value. Additionally the
       UA may choose to only perform such rounding in certain window
       configurations (e.g. only when maximized).
     * In all cases the UA may round values as appropriate to accommodate
       limitations in floating-point storage and arithmetic.

[PWGMSN]
     Ron Bergman; Tom Hastings. Media Standardized Names. 26 February 2002.
     IEEE ISTO Printer Working Group 5101.1-2002.
     URL: ftp://ftp.pwg.org/pub/pwg/candidates/cs-pwgmsn10-20020226-5101.1.pdf

[1] any ratio N/D where D ∈ {x∈ℤ|1≤x≤12} and N ∈ {x∈ℤ|1≤x≤2D}

Some changes to consider:
   - Changing 5% to some other %
   - Tweaking the formula in the second-to-last rule.

~fantasai

Received on Tuesday, 21 August 2007 20:55:45 UTC