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

[css3-values] calc() grammar needs flexibility about units

From: L. David Baron <dbaron@dbaron.org>
Date: Wed, 16 Dec 2009 16:42:48 -0500
To: www-style@w3.org
Message-ID: <20091216214248.GA5217@pickering.dbaron.org>
The grammar for the calc function in
http://dev.w3.org/csswg/css3-values/#the-calc-function currently
#   <atomic-length> := <number><length-unit>

This unnecessarily restricts calc() to lengths, contradicting even
the examples in the specification, which use both lengths and

However, it seems that the values allowed in calc() expressions
should be allowed to be whatever numbers with units are allowed on a
value at the point where the calc(), min(), or max() occurs.  These
could be lengths, percentages, angles, times, or frequencies.

I think the <atomic-length> production in the calc() grammar should
be changed to explain this (and, in particular, that it is dependent
on what types of values are allowed at the point where the calc()
expression is used).

Furthermore, I think the use of "length" in the production names in
the calc() grammar should probably be replaced with "value" or
something similar, to reflect that these productions are not
specific to lengths.

That said, it's possible we want to leave most of the restriction in
the prose that says:
  # The calc(<expression>) function can be used wherever length
  # values are allowed, with the syntax given below.
and not allow calc() for angles, times, or frequencies.  However, if
we do this, the specification still needs updating for percentages,
since we want to allow percentages inside calc() where percentages
are otherwise allowed.


L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/
Received on Thursday, 17 December 2009 01:39:31 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:07:41 UTC