RESOLVED WORKSFORME20258
HTML5 canvas: fillRect() and friends do not support negative heights
https://bugs.webkit.org/show_bug.cgi?id=20258
Summary HTML5 canvas: fillRect() and friends do not support negative heights
David Jones
Reported 2008-08-01 14:20:17 PDT
PROBLEM fillRect(x, y, w, h) will fail with "INDEX_SIZE_ERR: INDEX_SIZE_ERR: DOM Exception 1" (or something like that) when h is negative. There's nothing in the spec to prohibit fillRect() from taking a negative h. The specification requires that the path be formed from the four coordinates: "(x, y), (x+w, y), (x+w, y+h), (x, y+h)". These four coodinates still have a perfectly sensible interpretation when either h or w is negative, and there's nothing I can see in the spec from prohibiting h and w from being negative. It is sometimes even quite natural to use a negative h, for example if one has flipped the Y-axis by issuing a scale(1,-1) then one still might want (x,y) to be the top-left of a rectangle, in which case h will be negative.
Attachments
Negative width/height (455 bytes, text/html)
2008-08-21 21:14 PDT, Dirk Schulze
no flags
Dirk Schulze
Comment 1 2008-08-21 21:14:13 PDT
Created attachment 22929 [details] Negative width/height This test has a negative with and height for fillRect() and strokeRect(). Can't confirm it on cairo but can not test Safari.
David Jones
Comment 2 2008-08-22 00:32:53 PDT
Ah thanks for the test (odd, I had one lying around when I reported the bug, I wonder why I didn't add it). Running the test on Safari results in no visible output and "INDEX_SIZE_ERR: DOM Exception 1" in the error console.
Dirk Schulze
Comment 3 2008-12-07 23:56:47 PST
Can't confirm it on Mac with the latest trunk. Possibly fixed in some earlier versions. Do you still have problems with it? Please try one of the http://nightly.webkit.org/ builds to check.
Oliver Hunt
Comment 4 2008-12-29 04:09:53 PST
I agree with dirk, the code obviously supports this behaviour, and the testcase passes. I assume this has been fixed at some point.
Note You need to log in before you can comment on or make changes to this bug.