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

Re: WebKit now supports CSS Variables

From: David Hyatt <hyatt@apple.com>
Date: Tue, 24 Jun 2008 13:36:45 -0500
To: Håkon Wium Lie <howcome@opera.com>
Cc: www-style list <www-style@w3.org>
Message-id: <0E79C483-8A9F-4A1E-A1D0-414814DE7319@apple.com>


On Jun 24, 2008, at 1:29 PM, Håkon Wium Lie wrote:

> Also sprach David Hyatt:
>
>>> Still, it may be simpler and better not to allow any such crossing.
>>> Take for instance this example:
>>>
>>> style sheet 1: @variable { X: 10px }
>>> style sheet 2: @variable { X: none }
>>> style sheet 3: div { width: var(X) }
>>>
>>> Style sheet numbering is in document order. If the
>>> fininshed-loading-order is: 3, 1, 2, the width declaration would  
>>> first
>>> be invalid ("The declaration becomes invalid if the variable does  
>>> not
>>> exist") then valid with 10px, and then invalid again when X is none.
>>
>> In WebKit at least, the parsing of the declaration with the variable
>> call is delayed until all stylesheets have been loaded (we don't show
>> any content in WebKit while stylesheets are still loading).
>
> Ok, so you don't see the problem outlined above. Opera supports
> progressive rendering of content as style sheets are loaded so for us
> the problem is real.
>
> Progessive rendering of content is a long-established concept in CSS
> and I don't think the benefit of variables outweight the cost of
> breaking progressive rendering.

I didn't say CSS variables broke progressive rendering.  They don't.   
All I said was that WebKit on the desktop and phone doesn't do it,  
since flashes of unstyled or wrongly styled content are ugly.  I know  
some mobile devices FOUC anyway. :)

This isn't really covered in the spec, but WebKit preserves variable- 
dependent values as unresolved in the CSS OM.  So progressive  
rendering (were we to do it) would even still work.  I don't see the  
problem.  If the variable is initially undefined, you preserve the  
property/value in the CSS OM with an unresolved value, and if at any  
time you can later resolve it (when new stylesheets load) you do.  The  
variable could end up using the wrong value before using the right one  
as well with progressive rendering, but that's no worse than getting  
the wrong style before getting the right one (which is what happens  
today with FOUC).

dave
Received on Tuesday, 24 June 2008 18:37:34 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:07 GMT