Re: [css3-values] The 'calc' function

On Wednesday 2010-04-07 17:35 -0700, L. David Baron wrote:
> This is an interesting question.  I definitely don't want to make
> inheritance depend on layout.  Given that, I think there are two
> reasonable options:
> 
>  (1) the computed value of a calc() expression is the expression
>  transformed by computing the value for all its leaf nodes
> 
>  (2) say that the computed value of a calc() expression is the
>  expression itself
> 
>  (3) say that the computed value of a calc() expression is the
>  expression transformed by transforming all relative length units
>  into absolute units.
> 
> Initially, I would have thought that (1) was the logical choice.

Actually, I think there's another option that might make the most
sense:

  (4) say that the computed value of a calc() expression is the
  expression transformed by:
    (a) transforming all relative length units into absolute units
    (b) transforming all percentages just as they are transformed
    when computing the value of the property.

This has the significant advantage that for properties that don't
accept percentages or where percentages are computed for the
computed value, calc() does not add any complexity to the
representation of the computed value (which means less complexity in
the implementation).

(I'd also note that, with any of the proposals, user agents should
be free to perform any desired syntactic simplification they want
based on mathematical equivalence.)

-David

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

Received on Thursday, 8 April 2010 00:53:34 UTC