GNOME Bugzilla – Bug 795923
css.lang: Numbers and units fixes
Last modified: 2018-05-09 09:23:53 UTC
There are a few issues with current number/unit highlighting: * Scientific notation isn't accepted for numbers with units (e.g. 1e3px) * Turn unit (e.g. rotate(1.5turn)) isn't highlighted * Resolutions (e.g. 72dpi) must be strictly positive * Numerators/denominators of aspect ratios (e.g. 16/9) are highlighted as separate numbers * Invalid numbers (i.e. "12.") are highlighted Will attach a patch shortly. (This is a continuation of bug 795550)
Created attachment 371802 [details] [review] css.lang: Numbers and units fixes * Unify number and float contexts, adding a number regex that more closely follows the CSS definition of a number[1] * Use the number regex for dimension and resolution contexts * Add the turn unit to the dimension context * Make resolutions strictly positive (allowing for an optional plus sign)[2] * Add a ratio context for aspect ratio media queries[3] Note that the ratio context doesn't use the number regex, because ratios only allow (strictly positive) integers for their numerators and denominators. [1] https://developer.mozilla.org/en-US/docs/Web/CSS/number [2] https://developer.mozilla.org/en-US/docs/Web/CSS/resolution [3] https://developer.mozilla.org/en-US/docs/Web/CSS/ratio
Thanks, pushed as commit 896e22d6b6ebf172823f249235c28f36482f7ed1.