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
Created attachment 59721 [details] Proposed patch
Comment on attachment 59721 [details] Proposed patch Not quite there.
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."
Created attachment 60249 [details] Proposed patch v3 Ok, a patch for *this* bug now :-)
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.
Comment on attachment 60249 [details] Proposed patch v3 Clearing flags on attachment: 60249 Committed r62277: <http://trac.webkit.org/changeset/62277>
All reviewed patches have been landed. Closing bug.
(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.