<number-optional-number> and integer pairs

Hi list members,

Right now we have two attributes that use integer pairs in SVG DOM: 'order' and 'filterRes'. But both attribute values should be parsed as <number-optional-number> [1]. Means we have to take any number but transform them to integer.

<number-optional-number>
A pair of <number>s, where the second <number> is optional.

number-optional-number ::= number
                           | number comma-wsp number
In the SVG DOM, a <number-optional-number> is represented using a pair of SVGAnimatedInteger or SVGAnimatedNumber objects.


But just for 'filterRes' it is specified what to do if the number is not an integer [2]:

"Non-integer values are truncated, i.e rounded to the closest integer value towards zero."

It is not specified what to do for the 'order' attribute.
Right now WebKit rounds the values of 'filterRes' and 'order' to integers after parsing them as <number>. Opera rounds at least 'filterRes' (did not check 'order') and according to Robert Longson FireFox just excepts integers.

I think it is kind of bad to let <number-optional-number> represent number pairs _and_ integer pairs. I'd suggest to either add a new SVG  data type <integer-optional-integer> or don't use pairs but single attributes: 'orderX', 'orderY', 'filterResX', 'filterResY'.

Dirk

[1] http://www.w3.org/TR/SVG/types.html#DataTypeNumberOptionalNumber
[2] http://www.w3.org/TR/SVG/filters.html#FilterEffectsRegion

Received on Tuesday, 6 September 2011 08:34:26 UTC