W3C home > Mailing lists > Public > public-svg-wg@w3.org > January to March 2009

Proposal for clarifying edge-cases for the rx and ry handling on the rect element

From: Erik Dahlstrom <ed@opera.com>
Date: Tue, 17 Feb 2009 19:07:38 +1100
To: "public-svg-wg@w3.org" <public-svg-wg@w3.org>
Message-ID: <op.uphku0aggeuyw5@macbooked.local>
Hello svg-wg,

I was given ACTION-2367 to propose wording for clarifying the handling of rx and ry on rect elements[2].

After having tested a number of implementations[1], it's clear that there are differences in some of the edgecases.

The paragraph in question:
[[ If a properly specified value is provided for rx but not for ry, then the user agent processes the 'rect' element with the effective value for ry as equal to rx. If a properly specified value is provided for ry but not for rx, then the user agent processes the 'rect' element with the effective value for rx as equal to ry. If neither rx nor ry has a properly specified value, then the user agent processes the 'rect' element as if no rounding had been specified, resulting in square corners. If rx is greater than half of the width of the rectangle, then the user agent processes the 'rect' element with the effective value for rx as half of the width of the rectangle. If ry is greater than half of the height of the rectangle, then the user agent processes the 'rect' element with the effective value for ry as half of the height of the rectangle. ]]

I propose to change that to the following algorithm (in pseudocode):

if(rx)
  clamp(rx, width/2)

if(ry)
  clamp(ry, height/2)

if(rx && !ry) {
  ry = rx;
  clamp(ry, height/2);
}

if(!rx && ry) {
  rx = ry;
  clamp(ry, width/2);
}  

Here's some wording based on that:
[[

If both rx and ry is provided, each of the values clamping will limit rx to a maximum of half of the width of the rectangle and for ry half of the height of the rectangle. 

If only one of rx and ry is provided, the clamped value of ry will be used as the rx value and vice versa. The unspecified rx or ry attribute is given the specified value, and that value will again be clamped, for rx the clamping will limit rx to a maximum of half of the width of the rectangle and for ry half of the height of the rectangle. 

]]

[1] http://dev.w3.org/SVG/profiles/1.1F2/test/svg/shapes-rect-03-t.svg
[2] http://www.w3.org/TR/SVG11/shapes.html#RectElement

-- 
Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed
Received on Tuesday, 17 February 2009 08:08:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 17 February 2009 08:08:55 GMT