W3C home > Mailing lists > Public > public-fx@w3.org > January to March 2012

Extend SVG parser for 'transform'

From: Dirk Schulze <dschulze@adobe.com>
Date: Mon, 13 Feb 2012 15:28:36 -0800
To: "public-fx@w3.org" <public-fx@w3.org>
Message-ID: <8996DBAE-9FE2-44D6-9B9B-B0E4CC05A7E6@adobe.com>
Hi,

Like described on "Merged Transforms"[1], the parsing behavior between SVG and CSS differs a lot. To solve this issue, I suggest to extend the SVG parser for the SVG 'transform' attribute to support the CSS parsing rules as well. Therefore the syntax of existing SVG content will still be valid. Currently and future specified transformation functions from CSS Transform will work for the attribute as well. SVG users can still use the old syntax for existing and new functions. Unit less values will still be supported. I would like to add the following section to CSS Transforms (http://dev.w3.org/csswg/css3-transforms/). The proposed text is using the same wording style like CSS Values and Units[2]. Do you accept the proposal?

==Syntax for SVG 'transform' attribute==

To provide backward compatibility, the syntax of the XML attribute 'transform' differs to the syntax of the style property. Even so the syntax of the style property is still valid for the attribute and it is recommended for authors to follow the rules of CSS Values [http://www.w3.org/TR/css3-values/#functional-notation] for 'transform' attributes as well. 

===Transformation Function List===
The values for the 'transform' attribute consists of a list of zero or more transformation functions in the 'functional notation'. If the list of transformation functions consists of more than one transformation function, these functions are separated by either a comma (,) with optional whitespace before and after the comma or one or more whitespaces. The list of transformation functions can have optional whitespaces before and after the list.

===Functional Notations===
The syntax starts with the name of the function followed by optional whitespaces followed by a left parenthesis followed by optional whitespace followed by the argument(s) to the notation followed by optional whitespace followed by a right parenthesis. If a function takes more than one argument, the arguments are either separated by a comma (,) with optional whitespace before and after the comma or one or more whitespaces.

===Data Types===
Arguments of transformation functions consists of data types in the sense of CSS Values [http://www.w3.org/TR/css3-values/#functional-notation]. The definitions of data types in CSS Values gets enhanced as follows:

====The '<translation-value>' and '<length>' type====
A translation-value or length can be a '<number>' ''without'' a unit identifier. In this case the ''number'' gets interpreted as "user unit". A user unit in the the initial coordinate system is equivalenced to the parent environment's notion of a px unit [SVG 11 http://www.w3.org/TR/2003/REC-SVG11-20030114/coords.html#InitialCoordinateSystem].

====The '<angle>' type====
An angle can be a '<number>' ''without'' a unit identifier. In this case the ''number'' gets interpreted as degrees according to [SVG 11 http://www.w3.org/TR/SVG/coords.html#TransformAttribute].

====The '<number>' type====
SVG supports scientific notations for numbers. Therefore a ''number'' gets parsed like described in SVG's <a href="http://www.w3.org/TR/SVG/types.html#DataTypeNumber">Basic data types</a> for SVG attributes.

Greetings,
Dirk

[1] http://www.w3.org/Graphics/fx/wiki/Merged_Transforms
Received on Monday, 13 February 2012 23:29:03 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 13 February 2012 23:29:04 GMT