W3C home > Mailing lists > Public > www-style@w3.org > June 2012

Re: [css3-flexbox] "flex-basis: auto" means completely different things as specified value vs. computed value

From: Daniel Holbert <dholbert@mozilla.com>
Date: Mon, 04 Jun 2012 14:25:41 -0700
Message-ID: <4FCD27D5.9090404@mozilla.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
CC: www-style <www-style@w3.org>, Boris Zbarsky <bzbarsky@MIT.EDU>
On 06/04/2012 10:53 AM, Tab Atkins Jr. wrote:
>> MAIN CONCERN: It's weird to have a particular value ("auto" in this
>> case) mean two completely different things as a specified value vs. as a
>> computed value.
> 
> Yeah, it's a little weird, but the alternative is to come up with
> *another* term meaning the same thing as 'auto', just for stacked-auto
> situations like this.

That's _one_ alternative (the first one I mentioned at the end of this
email), but it's not the only one.

The other/better alternative (which I was lobbying for) is to make
"flex-basis:auto" simply compute to "auto", which has one and only one
meaning.  (look at the 'width' or 'height' property and use that)

As I noted before, that is how "auto" is specced for "width" and
"height" (getComputedStyle hacks aside), so there's definitely precedent
for this behavior.

>> SUB-CONCERN: It's weird that "flex-basis:inherit" can end up inheriting
>> a computed value of "auto", which then deceptively makes us _ignore_ our
>> main-size property. (while a _specified_ value of "auto" would make us
>> _use_ our main-size property)
> 
> This is incorrect, because you're assuming that the "inherit" swap-out
> occurs at computed-value time. Instead, it happens at specified-value
> time, when a cascaded value of "inherit" turns into a specified value
> of the parent's computed value.

Firstly -- to be clear, the _value that gets inherited_ is the parent's
computed value, right? (per CSS 2.1:
http://www.w3.org/TR/CSS21/cascade.html#inheritance )

Assuming we agree on that -- it sounds like you're saying we take the
parent's computed value and set it set it as the child's _specified
value_. (which might then compute to something else)

With that clarification, this is still very bizarre, IMHO.  This means
that the "auto" value that I inherit from my parent (in the scenario
from my toplevel post) means something *completely* different on my
parent vs. what it means on me.  (It means "start flexing at max-content
size" on my parent, whereas it means "look at your width property" when
I inherit it onto myself.)

It also sounds like inheritance wouldn't necessarily propagate across
generations -- e.g. if you stuck another level of...
   <div style="display:flex; flex-basis: inherit"></div>
...inside of the innermost div in the example from my top-level post,
then *that* div would inherit something _different_ ("50px") from what
its parent inherited ("auto"), even though both it and its parent have
"flex-basis:inherit".  Is that correct?

This proposed "convert-to-a-specified-value" step goes against how
inheritance is currently implemented (at least in Gecko), and I suspect
it'd break a lot of our style system's optimizations, though bz would
know better.

I feel very strongly that this all would be a lot saner (conceptually &
implementation-wise) if "flex-basis:auto" simply computed to "auto".
(and then we just react to that value from within layout, and from
within getComputedStyle if we like)

~Daniel
Received on Monday, 4 June 2012 21:26:10 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:55 GMT