Re: [css3-transforms] Extending CSSOM interface

On Feb 16, 2012, at 10:36 AM, Simon Fraser wrote:

> On Feb 16, 2012, at 9:57 AM, Dirk Schulze wrote:
> 
>> Hi www-style,
>> 
>> I would like to see some changes to the current interfaces of CSS Transforms. This is also described in the Wiki "Merged Transforms"[0]. Currently CSS Transforms specifies 'CSSMatrix' and 'CSSTransformValue'.
> 
> First we should decide if this version of the spec should define any CSS OM stuff, given the in-flux state of CSS OM in general.
I agree.

>> 
>> * I would like to see 'CSSTransformValue' extended by the following setters:
>> 
>>   void setMatrix(in CSSMatrix matrix);
>>   void setTranslate(in double tx, in double ty);
>>   void setScale(in double sx, in double sy);
>>   void setRotate(in double angle, in double cx, in double cy);
>>   void setSkew(in double angle-horizontal, in double angle-vertical);
> 
> I disagree here. CSSTransformValue is just a way to describe a single transform function in the CSSValueList returned by getPropertyCSSValue(). It should be read-only, and not a general way to manipulate matrices.
Why just make it readonly? Why not make it accessible to the author? How can CSSTransformValue help the author when it is just readable? Also cssText() still should work (it is a CSSValue), why not support special setters than?


> 
>> 
>> The arguments ty, sy, cx, cy, angle-vertical are optional and get set to 0 or 1 according to their definitions on "Transformation Functions". cx, cy may get removed depending on the solution of [1]. Calling one of these functions would change the 'operationType' of the affected transformation function as well as the values of the member 'CSSMatrix'. The individual function description would be similar to SVGTransform[1].
>> 
>> * Rename 'CSSTransformValue' to 'CSSTransform'. This would just be an esthetic change to match what we already have in SVG: 'SVGTransform'.
> 
> No. SVGTransform is equivalent to CSSMatrix, not CSSTransformValue.
SVGMatrix is equivalent to CSSMatrix. SVGTransform describes a transformation function. So it is like described in my original mail.

> 
>> 
>> * Add 'CSSTransformList'. The current spec already speaks about a transform list for the property but doesn't define it. I would like to add an interface that gives wide control of transform handling to the web author. The interface could look like this:
>> 
>> interface CSSTransformList {
>>   readonly attribute unsigned long numberOfItems;
>> 
>>   void clear() raises(DOMException);
>>   CSSTransform initialize(in CSSTransform newItem) raises(DOMException);
>>   CSSTransform getItem(in unsigned long index) raises(DOMException);
>>   CSSTransform insertItemBefore(in CSSTransform newItem, in unsigned long index) raises(DOMException);
>>   CSSTransform replaceItem(in CSSTransform newItem, in unsigned long index) raises(DOMException);
>>   CSSTransform removeItem(in unsigned long index) raises(DOMException);
>>   CSSTransform appendItem(in CSSTransform newItem) raises(DOMException);
>>   CSSTransform createCSSTransformFromMatrix(in CSSMatrix matrix);
>>   CSSTransform consolidate() raises(DOMException);
>> }
>> 
>> The function descriptions are similar to SVGTransformList [3].
> 
> This is what CSSValueList is for.
But CSSValueList does not allow to specify the order, add or remove transformation functions. You can just reset everything with cssText().

> 
>> 
>> * Define 'CSSMatrix', 'CSSTransform(Value)' and 'CSSTransformList' as "live". Changes on 'CSSTransformValue' would influence the member 'CSSMatrix'. 'getMatrix()' on 'CSSMatrix', 'getItem()' on 'CSSTransformList' return references to the objects, not copies.
>> 
>> Greetings,
>> Dirk
>> 
>> [0] http://www.w3.org/Graphics/fx/wiki/Merged_Transforms#CSSOM_issues
>> 
>> [1] http://lists.w3.org/Archives/Public/www-style/2012Feb/0692.html
>> [2] http://www.w3.org/TR/SVG/coords.html#InterfaceSVGTransform
>> [3] http://www.w3.org/TR/SVG/coords.html#InterfaceSVGTransformList
> 
> Simon
> 

Dirk

Received on Thursday, 16 February 2012 18:52:52 UTC