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

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

From: L. David Baron <dbaron@dbaron.org>
Date: Wed, 16 Dec 2009 16:17:48 -0500
To: www-style@w3.org
Message-ID: <20091216211748.GA4906@pickering.dbaron.org>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 22 May 2012 03:47:12 GMT