Parse new SVG Transform presentation attributes with "SVG parsing rules"

Hi,

I wrote tests for the SVG 'transform-origin' presentation attribute and realized that I left out units on length values. I wonder if strict CSS parsing rules for presentation attributes could confuse other SVG folks as well.

I suggest, that all new introduced presentation attributes from the CSS Transforms [1] spec use the parsing rules of corresponding SVG data types for <length>[2] and <number>[3].

Following presentation attributes are affected[4]:

* 'perspective'
* 'perspective-origin'
* 'transform-origin'
We already resolved that 'transform' needs to be backwards compatible and therefore supports the SVG parsing rules for transforms.

Changes of the parsing in detail:

* <number>
  - support scientific notation as described in [3] (e.g -100e-2).
* <length>
  - allow unit less length values (the value gets interpreted as 'user unit' as described in [5])
  - support all units as described in CSS Values and Units [6]
* Values with multiple arguments must still be separated as described in CSS Values and Units [6]. There is no common way in SVG anyway (see [7], [8] and [9] for comparison).

Possible issues:

The issue was raised that functions like 'calc()' might not be able to support unit less values. As example: calc(20 40px)
Can calc resolve that this should be 60 pixels? I'll investigate how WebKit deals with it. It would be great to hear comments about other implementations.

Greetings,
Dirk

[1] http://dev.w3.org/csswg/css3-transforms/
[2] http://www.w3.org/TR/SVG/types.html#DataTypeLength
[3] http://www.w3.org/TR/SVG/types.html#DataTypeNumber
[4] http://dev.w3.org/csswg/css3-transforms/#property-index
[5] http://www.w3.org/TR/SVG/intro.html#TermUserUnits
[6] http://www.w3.org/TR/css3-values/
[7] http://www.w3.org/TR/SVG/types.html#DataTypeListOfFamilyNames
[8] http://www.w3.org/TR/SVG/types.html#DataTypeListOfStrings
[9] http://www.w3.org/TR/SVG/types.html#DataTypeList

Received on Tuesday, 27 March 2012 17:37:04 UTC