[whatwg] A question about the drawimage() canvas function

Robert O'Callahan robert at ocallahan.org
Sun Mar 3 01:32:18 PST 2013

On Sun, Mar 3, 2013 at 10:26 AM, Rik Cabanier <cabanier at gmail.com> wrote:

> On Fri, Mar 1, 2013 at 1:28 PM, Robert O'Callahan <robert at ocallahan.org>wrote:
>> I actually just wrote a patch to implement the spec behavior in Firefox.
>> I think changing behavior from "throw" to "not throw" shouldn't have any
>> compatibility concerns. I also think that "not throw" is better here than
>> throwing; it's simpler to not distinguish "finished downloading but
>> decoding failed" from "download in progress (but very slow perhaps)".
>> In fact I question why the spec has us throw for zero-sized canvas source.
>> It would seem to me to be simpler/better to just not draw and not throw in
>> that case also.
> Are you going ahead with this patch?
> This will change current behavior. If we agree ignoring the error makes
> more sense, we will have to change ie and wk as well as patch the canvas
> spec more.

My patch follows the current spec, not the revised proposal of
https://www.w3.org/Bugs/Public/show_bug.cgi?id=21173. So maybe I shouldn't
go ahead with it.

It would be really simple if we never throw and just paint nothing when we
don't have a valid image or the source has no pixels. Changing cases from
throwing to not throwing is very unlikely to cause compatibility risk. Why
not just do it?

Wrfhf pnyyrq gurz gbtrgure naq fnvq, “Lbh xabj gung gur ehyref bs gur
Tragvyrf ybeq vg bire gurz, naq gurve uvtu bssvpvnyf rkrepvfr nhgubevgl
bire gurz. Abg fb jvgu lbh. Vafgrnq, jubrire jnagf gb orpbzr terng nzbat
lbh zhfg or lbhe freinag, naq jubrire jnagf gb or svefg zhfg or lbhe fynir
— whfg nf gur Fba bs Zna qvq abg pbzr gb or freirq, ohg gb freir, naq gb
tvir uvf yvsr nf n enafbz sbe znal.” [Znggurj 20:25-28]

More information about the whatwg mailing list