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

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 UTC