Skip to content

Handling of non-finite floats in canvas APIs is even more confusing now #1785

@bzbarsky

Description

@bzbarsky

https://html.spec.whatwg.org/multipage/scripting.html#2dcontext says (well hidden; search for it):

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.

This doesn't actually specify a processing model very well (e.g. does the ignoring happen as soon as you find such an argument, as basically a monkeypatch to IDL processing, or does it happen as part of the algorithm steps after all argument conversions are done?). But that's a longstanding issue.

What's worse is that the refactor into partial interfaces makes it very unclear how this works. A simple example, quoting the spec:

[NoInterfaceObject]
interface CanvasPath {
...
  void moveTo(unrestricted double x, unrestricted double y);
};

CanvasRenderingContext2D implements CanvasPath;
Path2D implements CanvasPath;

When moveTo is invoked on a Path2D object with non-finite arguments, what happens and why? Note that Path2D is not "the 2D context interface".

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions