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

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

From: Dirk Schulze <dschulze@adobe.com>
Date: Tue, 27 Mar 2012 10:36:28 -0700
To: "public-fx@w3.org" <public-fx@w3.org>
Message-ID: <B3217D08-9A6C-4753-9D4B-8A9FBE8DD8CA@adobe.com>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 17:37:06 GMT