W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2015

[whatwg] Why CanvasRenderingContext2D uses WebIDL unrestricted float type?

From: Tetsuharu OHZEKI <saneyuki.snyk@gmail.com>
Date: Wed, 25 Mar 2015 05:06:19 +0900
Message-ID: <CACyPx=kMgNu7NT1UpjFfBAKH8BBaJeA-9Ta-FwgEMGkdfxOpWg@mail.gmail.com>
To: whatwg@whatwg.org
Hi everybody.

I have a question about the definition of CanvasRenderingContext2D's behavior.

The current spec about CanvasRenderingContext2D says the following:

> Except where otherwise specified, for the 2D context interface,
> any method call with a numeric argument whose value is infinite
> or a NaN value must be ignored.

But I think that, why don't  CanvasRenderingContext2D use restricted
float type defined in WebIDL if these methods ignore the value when
its is not finite?

By the current WebIDL spec
(http://heycam.github.io/webidl/#es-double), restricted values,
'float' & 'double', will raise TypeError in conversion phase under
ECMAScript environment if the passed value is a NaN or +-Infinity.

For the purpose to ignore non-restricted values, I feel that it's more
better to restrict by IDL type. So the definitions by the current spec
is for backward compatibility, or simply a spec issue?


Tetsuharu OHZEKI
Received on Tuesday, 24 March 2015 20:07:05 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:29 UTC