Re: Intent to ship: CSS Variables

2014-03-19 Thread smaug

On 03/18/2014 11:26 AM, Cameron McCormack wrote:

CSS Variables is a feature that allows authors to define custom properties that 
cascade and inherit in the same way that regular properties do, and to
reference the values of these custom properties in the values of regular 
properties (and other custom properties too).

   http://dev.w3.org/csswg/css-variables/

I blogged about the feature when it initially landed here:

   http://mcc.id.au/blog/2013/12/variables

It lives behind the layout.css.variables.enabled pref, which is currently 
enabled by default only on Aurora/Nightly.

One thing from the specification that we don't implement is the CSSVariableMap, 
but Tab tells me that this is going to be removed from the spec.

I intend to enable this feature by default this Friday (March 21).  That would 
target Firefox 31.

The spec has been stable for a while, and the CSS Working Group already has a 
resolution to publish the document as a Candidate Recommendation.

There has been a last minute proposal for a change to the syntax of custom 
property declarations, to align with other custom features in CSS that are
coming down the pipeline (such as custom media queries).  There are a couple of proposals 
on the table: to replace the var- prefix of the name of
the custom property with a _ prefix, or perhaps just anywhere within the name.  Similarly for 
-- rather than _.

Tab wants to discuss this in this week's CSS Working Group telcon, so if the 
decision is made quickly enough we can update our implementation. The CSS
Working Group is aware of our plans to ship.

Bug to enable this feature: https://bugzilla.mozilla.org/show_bug.cgi?id=957833

Blink until recently had an implementation of CSS Variables, behind a flag, but 
not one that supported the fallback syntax (or CSSVariableMap).  They
have recently removed it saying that they need to rewrite as it had poor 
performance, but they say they are still interested in the feature


Curious, how much have we tested the performance of our implementation and are 
there some known perf issues?


-Olli

___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Re: Intent to ship: CSS Variables

2014-03-19 Thread Cameron McCormack

smaug wrote:

Curious, how much have we tested the performance of our implementation
and are there some known perf issues?


I have not tested.  The only extra work we should be doing at the moment 
when variables aren't used in the style sheet is 
nsRuleNode::ResolveVariableReferences.  That iterates over all of the 
properties we are computing for a given frame and checks to see if they 
are a token stream, and if so, reparses them.


If this is a problem we could easily record on the 
nsCSS{Compressed,Expanded}DataBlock object during the initial parsing 
whether a property with a variable reference on the right hand side was 
encountered, and copy that over when we map the properties into the 
nsRuleData.  Then we could skip the ResolveVariableReferences call if we 
knew we didn't find any properties with variable references.


When variables are used, we do end up having to parse a 
variable-reference-using property value twice (once to ensure that 
variable references are syntactically valid and to record which 
variables are referenced, and another time after expanding out the 
variable references), but that is basically what is required by the spec.

___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Intent to ship: CSS Variables

2014-03-18 Thread Cameron McCormack
CSS Variables is a feature that allows authors to define custom 
properties that cascade and inherit in the same way that regular 
properties do, and to reference the values of these custom properties in 
the values of regular properties (and other custom properties too).


  http://dev.w3.org/csswg/css-variables/

I blogged about the feature when it initially landed here:

  http://mcc.id.au/blog/2013/12/variables

It lives behind the layout.css.variables.enabled pref, which is 
currently enabled by default only on Aurora/Nightly.


One thing from the specification that we don't implement is the 
CSSVariableMap, but Tab tells me that this is going to be removed from 
the spec.


I intend to enable this feature by default this Friday (March 21).  That 
would target Firefox 31.


The spec has been stable for a while, and the CSS Working Group already 
has a resolution to publish the document as a Candidate Recommendation.


There has been a last minute proposal for a change to the syntax of 
custom property declarations, to align with other custom features in CSS 
that are coming down the pipeline (such as custom media queries).  There 
are a couple of proposals on the table: to replace the var- prefix of 
the name of the custom property with a _ prefix, or perhaps just 
anywhere within the name.  Similarly for -- rather than _.


Tab wants to discuss this in this week's CSS Working Group telcon, so if 
the decision is made quickly enough we can update our implementation. 
The CSS Working Group is aware of our plans to ship.


Bug to enable this feature: 
https://bugzilla.mozilla.org/show_bug.cgi?id=957833


Blink until recently had an implementation of CSS Variables, behind a 
flag, but not one that supported the fallback syntax (or 
CSSVariableMap).  They have recently removed it saying that they need to 
rewrite as it had poor performance, but they say they are still 
interested in the feature.

___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Re: Intent to ship: CSS Variables

2014-03-18 Thread Ehsan Akhgari

On 2014-03-18, 5:26 AM, Cameron McCormack wrote:

CSS Variables is a feature that allows authors to define custom
properties that cascade and inherit in the same way that regular
properties do, and to reference the values of these custom properties in
the values of regular properties (and other custom properties too).

   http://dev.w3.org/csswg/css-variables/

I blogged about the feature when it initially landed here:

   http://mcc.id.au/blog/2013/12/variables


Yay!  I'm really excited about this.  This feature is extremely useful 
to web developers and AFAIK they have been asking for it for quite a while!



It lives behind the layout.css.variables.enabled pref, which is
currently enabled by default only on Aurora/Nightly.

One thing from the specification that we don't implement is the
CSSVariableMap, but Tab tells me that this is going to be removed from
the spec.

I intend to enable this feature by default this Friday (March 21).  That
would target Firefox 31.

The spec has been stable for a while, and the CSS Working Group already
has a resolution to publish the document as a Candidate Recommendation.

There has been a last minute proposal for a change to the syntax of
custom property declarations, to align with other custom features in CSS
that are coming down the pipeline (such as custom media queries).  There
are a couple of proposals on the table: to replace the var- prefix of
the name of the custom property with a _ prefix, or perhaps just
anywhere within the name.  Similarly for -- rather than _.

Tab wants to discuss this in this week's CSS Working Group telcon, so if
the decision is made quickly enough we can update our implementation.
The CSS Working Group is aware of our plans to ship.


It's great that you mentioned this concern.  It seems like this is 
something that we can address soon depending on the decision of the WG, 
so I don't think this is a blocker to proceeding (we seem to have enough 
time for pulling the brakes if the WG does not come to a decision in 
time for any reason.)



Bug to enable this feature:
https://bugzilla.mozilla.org/show_bug.cgi?id=957833

Blink until recently had an implementation of CSS Variables, behind a
flag, but not one that supported the fallback syntax (or
CSSVariableMap).  They have recently removed it saying that they need to
rewrite as it had poor performance, but they say they are still
interested in the feature.


Yes, I followed that discussion.  It's unfortunate that Blink was not in 
a good position to ship this soon, but it seems like they are working on 
it, so I think it makes sense for us to ship this API at this point.


Cheers,
Ehsan

___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform