Re: [cssom] CSS Value API

On Tue, 17 Aug 2010 22:43:07 +0200, Simon Fraser <smfr@me.com> wrote:
> On Aug 17, 2010, at 4:04 AM, Anne van Kesteren wrote:
>> Implementors: From potential implementors I would like to know how  
>> interested they are in seeing the CSSOM Value API happen soon. If I  
>> define this will this be experimented with in implementations or is  
>> this something that will take a very long time (if ever) before being  
>> adopted?
>
> I'm interested in having an API that we can experiment with in WebKit  
> soon (but finding the time to implement it may take longer).
>
> We have some content for which the cost of parsing CSS transforms is  
> significant, and a new OM API would have a measurable benefit here.

Tab replied positively too, so that's nice.

My main problem with defining this is that I keep wondering whether the  
design is acceptable and what walls am I going to hit. Having an  
implementation alongside the specification would help a lot. The basic  
idea is in the specification, it just needs a lot of words on the details,  
but I think those details are best filled based on implementation and  
authoring experience.

To explain the idea here again (in case it is not all that clear from the  
specification) is that CSSStyleDeclaration objects get a new member values  
which returns an associated object called CSSStyleDeclarationValue. On  
this object you can get a CSSValue object for each property that is in  
scope of the CSSStyleDeclaration object (i.e. all for computed, just those  
specified for specified, etc.).

This CSSValue object in turn implements several interfaces depending on  
the property. E.g. for 'color' the CSSValue object would also implement  
CSSComponentValue, CSSKeywordComponentValue, and CSSColorComponentValue.  
'column-fill' would implement CSSComponentValue and  
CSSKeywordComponentValue. 'background-color' would implement  
CSSPropertyValueList and each member of that list would implement the same  
as 'color'.

Now manipulating should be easy. E.g. style.values.color.keyword = "red"  
sets 'color' to red. If you then set style.values.color.green = 1,  
style.values.color.keyword will no longer return "red" and  
style.values.color.type will have changed from "keyword" to "color".


So I think the way I want this to move forward is by answering specific  
questions related to either experimental or theoretical implementations  
rather than trying to set out a grand plan for how this ought to work from  
the start. Does that seem reasonable or should I just make something up  
anyway?


-- 
Anne van Kesteren
http://annevankesteren.nl/

Received on Tuesday, 31 August 2010 13:17:06 UTC