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

Re: [css3-transforms] Extending CSSOM interface

From: Simon Fraser <smfr@me.com>
Date: Thu, 16 Feb 2012 10:36:33 -0800
Cc: www-style list <www-style@w3.org>
Message-id: <82BDB92B-596C-4E3A-A8EE-D943E4782926@me.com>
To: Dirk Schulze <dschulze@adobe.com>
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 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.

> 
> 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.

> 
> * 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.

> 
> * 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
Received on Thursday, 16 February 2012 18:37:25 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:50 GMT