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


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)


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


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.


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