This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 21173 - The logic that checks the usability of the image is not correct
Summary: The logic that checks the usability of the image is not correct
Status: RESOLVED WONTFIX
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-02 05:11 UTC by rcabanie
Modified: 2013-06-03 19:51 UTC (History)
4 users (show)

See Also:


Attachments

Description rcabanie 2013-03-02 05:11:16 UTC
The canvas spec currently defines this:
(http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#check-the-usability-of-the-image-argument)

"When a user agent is required to check the usability of the image argument, where image is a CanvasImageSource object, the user agent must run these steps, which return either good, bad, or aborted:
1. If the image argument is an HTMLImageElement object that is not fully decodable, or if the image argument is an HTMLVideoElement object whose readyState attribute is either HAVE_NOTHING or HAVE_METADATA, then return bad and abort these steps.
2. If the image argument is an HTMLCanvasElement object with either a horizontal dimension or a vertical dimension equal to zero, then the implementation throw an InvalidStateError exception and return aborted."

This is not matching up with current implementations and the language in http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-drawimage:
"If the image has no image data, throws an InvalidStateError exception. If the image isn't yet fully decoded, then nothing is drawn."

After some discussion, we believe that this section should read as follows:
"When a user agent is required to check the usability of the image argument, where image is a CanvasImageSource object, the user agent must run these steps, which return either good, bad, or aborted:
1. If the image argument is an HTMLImageElement object in the broken state, then throw an InvalidStateError exception, return aborted and abort these steps.
2. If the image argument is an HTMLImageElement object that is not fully decodable, or if the image argument is an HTMLVideoElement object whose readyState attribute is either HAVE_NOTHING or HAVE_METADATA, then return bad and abort these steps.
3. If the image argument has either a horizontal dimension or a vertical dimension equal to zero, then the implementation throw an InvalidStateError exception and return aborted."
Comment 1 Ian 'Hixie' Hickson 2013-04-12 21:56:38 UTC
Do you have tests demonstrating the current behaviour?
Comment 2 Ian 'Hixie' Hickson 2013-06-03 19:49:17 UTC
WebKit seems to do what the spec says. (Blink too.)
Gecko seems to throw an exception for both broken images and images in the unavailable state.
IE seems to throw exceptions for broken images but not unavailable images.

I've updated the non-normative text to be clearer, but I don't see much value in changing the normative requirements.
Comment 3 contributor 2013-06-03 19:51:28 UTC
Checked in as WHATWG revision r7885.
Check-in comment: Make non-normative text more accurate.
http://html5.org/tools/web-apps-tracker?from=7884&to=7885