W3C home > Mailing lists > Public > www-style@w3.org > April 2014

RE: [css-values] Concrete proposal for unit algebra in calc()

From: Matt Rakow <marakow@microsoft.com>
Date: Wed, 23 Apr 2014 19:04:58 +0000
To: Zack Weinberg <zackw@panix.com>, www-style list <www-style@w3.org>
Message-ID: <ab1ab51b3921454c8a3cad607ec1ce80@BL2PR03MB260.namprd03.prod.outlook.com>
> -----Original Message-----
> From: Zack Weinberg [mailto:zackw@panix.com]
> Sent: Thursday, April 10, 2014 6:24 PM
> To: www-style list
> Subject: Re: [css-values] Concrete proposal for unit algebra in calc()
> 
> On 04/10/2014 06:41 PM, Simon Sapin wrote:
> > On 10/04/2014 20:43, Zack Weinberg wrote:
> [...]
> >>     4. If the left side is a <number> or <integer> and the right side
> >>        is a <length>, resolve to <resolution>.
> >>     5. If the left side is a <number> or <integer> and the right side
> >>        is a <time>, resolve to <frequency>.
> >
> > If we have those last two, should we also have these?
> >
> > (<number> or <integer>) / <resolution> = <length> (<number> or
> > <integer>) / <frequency> = <time>
> 
> Probably; I just missed those possibilities.  I'm not sure how necessary the
> special cases for the 1/x units are, though.
> 

The resolution ones aren't quite right.  The units for resolution are <physical pixels>/<CSS length>, not 1/<CSS length>.  For example:

<physical pixels> / <CSS inches> -> dpi
<physical pixels> / <CSS pixels> -> dppx

So the proposed combinations should actually result in:

<length> * <resolution> -> <physical pixels>
<number> / <length> -> <length^-1>
<number> / <resolution> -> <length> / <physical pixels>

Since we don't have units that equate to "physical pixels", "inverse length", or "length per physical pixel" I'd prefer to exclude these from the list until we have a well defined unit we can calc to.

Thanks,
-Matt
Received on Wednesday, 23 April 2014 19:05:31 UTC

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