[css3-values] Adding min() and max() into calc() grammar

In http://www.w3.org/mid/4A71E157.20600@inkedblade.net the working
group resolved to add min() and max() to calc(), as well as allowing
them at the top level where calc() is allowed.  I don't think
anybody has drafted any of the text for this yet, though, so here's
an attempt at the grammar, which seems to me to be the main
interesting part.

In http://dev.w3.org/csswg/css3-values/#the-calc-function , I think
the appropriate place to add these is the following:

Add the production:
<length-min-max> := ( 'min(' | 'max(' )
                    <length-expression>
                    ( ',' <length-expression> )+
                    ')'
to add min() and max() accepting 2 or more arguments.
(Alternatively, they could be required to take 1 or more arguments,
or could take exactly 2 arguments.)

Change the production:
<length> := calc( <length-expression> ) | <atomic-length>
into:
<length> := calc( <length-expression> ) | <length-min-max> | <atomic-length>
to allow min() and max() whereever calc() is allowed.

Change the production:
<length-term> := '(' <length-expression> ')' | <atomic-length>
into:
<length-term> := '(' <length-expression> ')' | <length-min-max> |
                 <atomic-length>
to allow min() and max() inside calc.  (They're safe anywhere
relative to additive and multiplicative operations since
grammar since they parenthesize their arguments.)


(I don't see any reason to add min() and max() to <number-term>.)

-David

-- 
L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/

Received on Thursday, 17 December 2009 01:39:29 UTC