Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dom/html: ImageData browser compatibility #2535

Closed
rakudrama opened this issue Apr 12, 2012 · 11 comments
Closed

dom/html: ImageData browser compatibility #2535

rakudrama opened this issue Apr 12, 2012 · 11 comments
Assignees
Labels
web-libraries Issues impacting dart:html, etc., libraries
Milestone

Comments

@rakudrama
Copy link
Member

ImageData is different on different browsers:

var image = context2d.createImageData(100, 200);

Chrome:
image is an ImageData object
image.data member is a CanvasPixelArray

FireFox 11:
image is a raw Object: {width: 100, height: 200, data: xxx}
image.data is a Uint8ClampedArray

We can wrap the image data to ensure the FF version is a valid Dart object. This would be a bit painful since it is also an input and would need to be unwrapped. Since the FF version is a raw object, presumably any object with the three properties would do - we could create a native class that has them but also has a prototype to attach Dart methods.

Not sure what to do to about .data property. To generate good code, dart2js would need to know that this has one of two disjoint types which have 'compatible' native methods.

Next action: explore other browsers.

@vsmenon
Copy link
Member

vsmenon commented Apr 13, 2012

Removed Area-UI label.
Added Area-DOM label.

@DartBot
Copy link

DartBot commented Apr 28, 2012

This comment was originally written by @bp74


Chrome 18 + Firefox 12 are working with Uint8ClampedArray.
Internet Explorer 9 still complaints because of a CanvasPixelArray.

Dart Editor Build 7066.

@DartBot
Copy link

DartBot commented May 4, 2012

This comment was originally written by @bp74


Looks like r7299 fixed it!
All browsers give you an Uint8ClampedArray now.

@rakudrama
Copy link
Member Author

Thanks for verifying, Bernhard.

I'm leaving this bug open to track the problem with the type of the returned ImageData object:

Chrome:
image is an ImageData object

FireFox 11:
image is a raw Object: {width: 100, height: 200, data: xxx}

@DartBot
Copy link

DartBot commented Jun 9, 2012

This comment was originally written by @bp74


With dart2js (build 8350) this issue is back.
In Firefox you can't access the "data" property of ImageData.

@kasperl
Copy link

kasperl commented Jun 20, 2012

Hi Stephen. Do you have any insights into what's happening here?


cc @rakudrama.

@rakudrama
Copy link
Member Author

Yes, see the initial report 'comment #­0'.
On Firefox we need to wrap every busted ImageData with a class that honours the interface.
The best way to do that is to introduce a general mechanism for handling objects that
need special processing coming from and / or going into the DOM.
This is a big change, but I'd rather fix the general problem.
If there I'd some specific urgency I can fix it by hand.

@rakudrama
Copy link
Member Author

Added this to the M1 milestone.
Marked this as being blocked by #4062.

@iposva-google
Copy link
Contributor

Removed Area-DOM label.
Added Area-HTML label.

@rakudrama
Copy link
Member Author

Set owner to @rakudrama.
Added Started label.

@rakudrama
Copy link
Member Author

Fixed r11193


Added Fixed label.

@rakudrama rakudrama added Type-Defect web-libraries Issues impacting dart:html, etc., libraries labels Aug 23, 2012
@rakudrama rakudrama self-assigned this Aug 23, 2012
@rakudrama rakudrama added this to the M1 milestone Aug 23, 2012
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
web-libraries Issues impacting dart:html, etc., libraries
Projects
None yet
Development

No branches or pull requests

5 participants