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

Re: [css-variables] Which value is substituted?

From: François REMY <fremycompany_pub@yahoo.fr>
Date: Fri, 5 Oct 2012 14:20:55 +0200
Message-ID: <FAA5CA5D285A420ABD1D2559F89C95C1@FREMYD2>
To: "Tom Potts" <karaken12@gmail.com>, "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: <www-style@w3.org>
I don’t have any strong opinion on this. This is just the way Brian and I wrote it down in our spec, but this doesn’t matter a lot.

In fact, the behavior we define is exactly the same. I had in mind “the specified value after any reference it contains has been resolved” and it seems the [css-variables] spec says that the computed value of a custom property is “the specified value with variables substituted”. So, the behavior is exactly the same. 

The reason why we used “specified value” instead of “computed value” is that we wanted to avoid to say that the computed value of a property may depend of the computed value of another one. The idea was to create a new layer between the specified and the computed style (let it be called the resolved style even if it’s not defined explicitely in the spec) where only references are resolved according to the reference resolving and cyclical invalidation rules but where no other modification is done. Creating that new “round” avoids any unthought interaction with other specs. If you specify only that it happens in the style computing, you create a state where some properties are fully computed (because they are referenced and therefore need to be computed first) where some others are still not.

But all this is pretty minor.


From: Tom Potts 
Sent: Friday, October 05, 2012 8:36 AM
To: Tab Atkins Jr. ; François REMY 
Cc: www-style@w3.org 
Subject: Re: [css-variables] Which value is substituted?
Thanks, Tab, François, I think those answers comprehensively answer my question. :o) 

If I can hijack the thread a little: François, why did you pick the specified value for 'use()'? The reason I started thinking about this was the kinds of non-obvious circular references Tab mentioned in an older thread.  For example
    line-height: 2em;
    font-size: use(line-height);
is a circular reference if 'use' produces the computed value; if it's reversed, as in
    font-size: 2em;
    line-height: use(font-size);
then neither version is a circular reference, but using the specified value produces lines twice as high as using the computed value.

So I'm not sure which is "correct" (if either) for 'use'; I'd be interested to hear why you've gone in the direction you have.

Thanks,
Tom

On 4 October 2012 17:38, Tab Atkins Jr. <jackalmage@gmail.com> wrote:

On Wed, Oct 3, 2012 at 11:48 PM, Tom Potts <karaken12@gmail.com> wrote:
> Hi, all.  Sorry if this has already been answered, but it wasn't clear to me
> from reading the spec.  When using a custom property reference (i.e.
> "var(foo)"), the spec says to substitute the "value" of the associated
> variable (relevant quotes are "... the variable's value is substituted as
> normal" and "A variable is substituted for its value in the property value
> at computed-value time.").  What's not clear to me here is what "value"
> actually means in this context.  The only reasonable candidates I can think
> of are the specified value and the computed value, but I think it's
> important which one of these is meant, and I don't think it's clear in the
> spec as written.


Oh, good catch!  I don't actually define that.  I'll fix.

It's the computed value (after resolving any var() references in the
corresponding var-* property, so that you're left with a var()-less
value).

~TJ
Received on Friday, 5 October 2012 12:21:15 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:01 GMT