[whatwg] Canvas normalize rect() and strokeRect()

Hi,

I looked at the behavior of negative width or height for the rect() and strokeRect() functions.

All browsers normalize the passed parameters for strokeRect() to have positive width and height.

strokeRect(90,10,-80,80) —> strokeRect(10,10,80,80)

http://jsfiddle.net/za945/

Just WebKit seems to normalize for rect() as well:

http://jsfiddle.net/VT4MG/

The behavior of normalizing is not specified. Especially it seems odd that the behavior for fillRect()/strokeRect() should differ from rect(). So we should either normalize for all functions or don’t do it for all IMO.

Note: fillRect() and clearRect() are not affected. The behavior for rect() is important for filling with different winding rules as well. It is not just stroking with dash arrays that is effected.

Greetings,
Dirk

Received on Saturday, 5 April 2014 16:01:48 UTC