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

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

From: Jonathan Watt <jwatt@jwatt.org>
Date: Thu, 05 Mar 2009 13:02:06 +0100
Message-ID: <49AFBF3E.5000901@jwatt.org>
To: public-svg-wg@w3.org
On 2/25/09 5:37 AM, Cameron McCormack wrote:
> Erik Dahlstrom:
>> I was given ACTION-2367 to propose wording for clarifying the handling
>> of rx and ry on rect elements[2].
> …
>> 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);
>> } 
> 
> I don’t have an opinion on whether clamping should happen in this order
> or such that the two clamp() calls happen just before the assignment
> statements they follow.
> 
> I’ll just briefly note though that the CSS3 Borders and Backgrounds
> module defines clamping of box boder radii in a different way:
> 
>   http://dev.w3.org/csswg/css3-background/#the-border-radius
> 
> which is basically to reduce all four corner radii uniformly until they
> fit, IIUC.

I've not looked at the CSS text yet, but that sounds like what Mozilla does. Our
algorithm is similar to the one proposed by Eric, but instead of:

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

we essentially do:

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

(Yes, clamping *x* based on *height*.) In essence we put a higher priority on
keeping the used rx and ry values the same if only one was specified.

Regardless of what Mozilla does, I think we should try to be consistent with CSS
here.

Jonathan
Received on Thursday, 5 March 2009 12:02:45 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 5 March 2009 12:02:47 GMT