Open Bug 1347268 Opened 9 years ago Updated 3 years ago

Change Canvas2D {get,put,create}ImageData() arguments from double to long

Categories

(Core :: Graphics: Canvas2D, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: fserb, Unassigned)

Details

(Keywords: dev-doc-needed, Whiteboard: [gfx-noted])

This is a heads up that we are considering changing the spec of getImageData() to improve interoperability. The gist of it is we are changing the IDL signature of the function from double to long, removing edge cases (dimensions in (0,1) range) and adding web platform tests. This is the relevant issue: https://github.com/whatwg/html/issues/2433 I'll update this with the spec and web-platform change when appropriate.
Hey Jet, would be good if someone looked at this sooner rather than later. We're about to change the standard here.
Flags: needinfo?(bugs)
+Milan on this one. We'll also want to coordinate with the other vendors on shipping this change.
Flags: needinfo?(bugs) → needinfo?(milan)
Summary: Upcoming changes to CanvasContext2D getImageData() → Change Canvas2D {get,put,create}ImageData() arguments from double to long
Flags: needinfo?(milan) → needinfo?(bzbarsky)
On the IDL level, there's no problem with making this change. The question is whether the resulting change in API behavior is one we're OK with, and the right place to sort that out is in the spec, right? I assume that's what the needinfo was for: "can someone familiar with the canvas API weigh in on the spec issue with Gecko's pov?" I'm not sure who on our side owns this stuff. Trying Jeff, because if he doesn't, I bet he knows who does.
Flags: needinfo?(bzbarsky) → needinfo?(jmuizelaar)
Yeah, we ended up changing the standard already (as well as corresponding tests, per comment 2) since it all seemed reasonable, but if there are any issues that would be good to know of course.
I know it may not count, but I did check the Gecko Canvas2D code before stating this. ;) Basically, all higher level functions on CanvasRenderingContext2D already move from float -> long using ToInt32 manually. The only real change there would be to remove the "if (sw == 0) sw = 1" code. IMO, the Gecko changes are even simpler than the Blink ones (which were already very simple). But feel free to take a closer look. :)))
(In reply to Boris Zbarsky [:bz] (still a bit busy) (if a patch has no decent message, automatic r-) from comment #4) > On the IDL level, there's no problem with making this change. That's the reason for the needinfo, so thanks!
Flags: needinfo?(jmuizelaar)
Status: UNCONFIRMED → NEW
Ever confirmed: true
OK, but I'd still like someone familiar with the canvas code to take a look at this _before_ everyone else ships the change and we're locked into it whether we want it or not.
Flags: needinfo?(jmuizelaar)
Sure thing. Not a lot of active people in canvas, but Markus is probably a good choice as well. I'm familiar with that front end part, and outside of making sure inf/NaN is properly handled, we should be OK with this change. Module reviewing the actual patch :)
inf/NaN would become 0, per the current spec bits, iirc.
Or something like that; currently inf/NaN throw "not supported" and 0 throws "index size".
Whiteboard: [gfx-noted]
I have no objection to doing this provided all of the other vendors do it to.
Flags: needinfo?(jmuizelaar)
FYI, Chrome already follows the updated spec.

It appears as though other vendors did not update their IDL, given the results of https://github.com/whatwg/html/issues/5336. Every browser still throws a TypeError when passed inf values.

Per Riot conversation: Blink did, but then added [EnforceRange] stuff that's not in the spec but made some wpts pass...

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.