W3C home > Mailing lists > Public > www-svg@w3.org > September 2011

<number-optional-number> and integer pairs

From: Dirk Schulze <vbs85@gmx.de>
Date: Tue, 6 Sep 2011 10:33:44 +0200
Message-Id: <D32FD438-8292-4893-9343-B177DE0783D3@gmx.de>
To: www-svg List <www-svg@w3.org>
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 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:49 GMT