RESOLVED FIXED 40271
The HTML5 canvas 2d.drawImage.zerocanvas test does not pass
https://bugs.webkit.org/show_bug.cgi?id=40271
Summary The HTML5 canvas 2d.drawImage.zerocanvas test does not pass
Jan Erik Hanssen
Reported 2010-06-07 16:56:02 PDT
The HTML5 canvas 2d.drawImage.zerocanvas test does not pass, the INVALID_STATE_ERR DOM exception should be set when no image data is present. http://philip.html5.org/tests/canvas/suite/tests/2d.drawImage.zerocanvas.html
Attachments
Proposed patch (4.34 KB, patch)
2010-06-24 19:58 PDT, Andreas Kling
no flags
Proposed patch v2 (4.23 KB, patch)
2010-06-24 21:10 PDT, Andreas Kling
no flags
Proposed patch v3 (4.78 KB, patch)
2010-07-01 08:03 PDT, Andreas Kling
no flags
Andreas Kling
Comment 1 2010-06-24 19:58:10 PDT
Created attachment 59721 [details] Proposed patch
Andreas Kling
Comment 2 2010-06-24 20:44:52 PDT
Comment on attachment 59721 [details] Proposed patch Not quite there.
Andreas Kling
Comment 3 2010-06-24 21:10:18 PDT
Created attachment 59726 [details] Proposed patch v2 Proper patch. See HTML5 spec at http://www.whatwg.org/specs/web-apps/current-work/#dom-context-2d-drawimage "If the image argument is an HTMLCanvasElement object with either a horizontal dimension or a vertical dimension equal to zero, then the implementation must raise an INVALID_STATE_ERR exception."
Andreas Kling
Comment 4 2010-07-01 08:03:12 PDT
Created attachment 60249 [details] Proposed patch v3 Ok, a patch for *this* bug now :-)
Darin Adler
Comment 5 2010-07-01 11:29:09 PDT
Comment on attachment 60249 [details] Proposed patch v3 > + if (!srcCanvasRect.width() || !srcCanvasRect.height()) { Could you use srcCanvasRect.isEmpty() instead? If so, I think it would read nicer.
WebKit Commit Bot
Comment 6 2010-07-01 11:43:05 PDT
Comment on attachment 60249 [details] Proposed patch v3 Clearing flags on attachment: 60249 Committed r62277: <http://trac.webkit.org/changeset/62277>
WebKit Commit Bot
Comment 7 2010-07-01 11:43:09 PDT
All reviewed patches have been landed. Closing bug.
Andreas Kling
Comment 8 2010-07-01 11:49:33 PDT
(In reply to comment #5) > (From update of attachment 60249 [details]) > > + if (!srcCanvasRect.width() || !srcCanvasRect.height()) { > > Could you use srcCanvasRect.isEmpty() instead? If so, I think it would read nicer. I could, but FloatRect::isEmpty() checks (width <= 0 && height <= 0) which would open some incorrect code paths until bug 39149 is fixed.
Note You need to log in before you can comment on or make changes to this bug.