- From: L. David Baron <dbaron@dbaron.org>
- Date: Wed, 7 Apr 2010 17:35:40 -0700
- To: Rossen Atanassov <ratan@microsoft.com>
- Cc: "www-style@w3.org" <www-style@w3.org>
On Tuesday 2010-04-06 23:32 +0000, Rossen Atanassov wrote: > First, the following sentence "The expression within the > parethesis is computed at the same time as 'em' lengths are > computed" (http://www.w3.org/TR/css3-values/#calc) suggests that > the value can be resolved during style cascade (independent of > layout). However, this is not going to work if percentage values > (as shown in the example) are to be supported since they can be > resolve only during layout. Agreed. > Further, if the 'value' is supposed to be inherited as an > expression then the following will be inconsistent with CSS 2.1 > > <parent style="width: 1em; font-size:100px" /> // clearly the with will compute to 100px; > <child style="width: inherit; font-size:200px" /> // the inherited value here will be 100px not 1em which resolved to 200px at this level > > <parent style="width: calc(1em); font-size: 100px" /> // clearly the with will compute to 100px; > <child style="width: inherit; font-size: 200px" /> // the inherited 'value' here will be 1em which will resolve to 200px and differ from the CSS 2.1 behavior above > > On the other hand if the value is to be inherited after layout resolution the following is inconsistent with CSS 2.1: > > Assume the available width after layout is 200px > <parent style="width: 50%;" /> // clearly the with will compute to 100px; > <child style="width: inherit;" /> // the inherited value here will be 50% which resolves to 50px at this level > > Assume the available width after layout is 200px > <parent style="width: calc(50%);" /> // clearly the with will compute to 100px; > <child style="width: inherit;" /> // the inherited value here will be 100px and differ from the CSS 2.1 behavior above > > I'd be great if anyone could clarify this. 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. However, when the working group discussed the various calc() issues I raised (see minutes in http://lists.w3.org/Archives/Public/www-style/2010Jan/0468.html ) I think there was a strong preference (at least from Steve) for calc() expressions to allow values that are not valid values of the property, as long as all the units cancel out in the end. This would require (2) or (3) rather than (1), since it would allow leaves that are not valid values of the property. This preference, however, is not fully reflected in Bert's proposal at http://lists.w3.org/Archives/Public/www-style/2010Feb/0170.html ; I think the "check:" constraints he describes on *, /, and mod are stronger than desired, since I *really* want to avoid situations where some groupings of mathematically-equivalent things are valid and some are invalid (for examples of what I mean by this, see http://lists.w3.org/Archives/Public/www-style/2009Dec/0296.html ). -David -- L. David Baron http://dbaron.org/ Mozilla Corporation http://www.mozilla.com/
Received on Thursday, 8 April 2010 00:36:09 UTC