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

Give <canvas>'s toDataURL() and toBlob() default parameter values #3430

Closed
annevk opened this issue Jan 30, 2018 · 4 comments · Fixed by #3477
Closed

Give <canvas>'s toDataURL() and toBlob() default parameter values #3430

annevk opened this issue Jan 30, 2018 · 4 comments · Fixed by #3477
Labels
clarification Standard could be clearer good first issue Ideal for someone new to a WHATWG standard or software project topic: canvas

Comments

@annevk
Copy link
Member

annevk commented Jan 30, 2018

In IDL we can change type and quality to default to "image/png" and 1.0 respectively. E.g.,

USVString toDataURL(optional DOMString type = "image/png", optional any quality = 1.0);

This would then allow a slight simplification of their algorithms as the arguments are now always given. "a serialization of the bitmap as a file" can similarly take advantage as all callers will always provide these arguments now (and we no longer leave the default implementation-defined, as is already the case for OffscreenCanvas).

@annevk annevk added clarification Standard could be clearer good first issue Ideal for someone new to a WHATWG standard or software project topic: canvas labels Jan 30, 2018
@donovanglover
Copy link
Contributor

I changed the IDL, but I'm not sure which parts of the spec need to be updated. Can you give me some hints?

@annevk
Copy link
Member Author

annevk commented Feb 17, 2018

E.g., in step 3 of #dom-canvas-todataurl it says "if they were given", but now we've supplied defaults they will always be given so that can be stricken. The same goes for the a serialization of the bitmap as a file "algorithm" (more like a block of text in its current form). The arguments will always be passed so don't need to be marked optional and there's no need to talk about a default value there either (in the final paragraph before the note). Does that help?

@donovanglover
Copy link
Contributor

donovanglover commented Feb 17, 2018

Thanks, that helped a lot!

Edit: I assume that I do the same for toBlob() as well?

@TimothyGu
Copy link
Member

@gloverdonovan Yup! We could replace "with type and quality if they were given" with "with type and quality" after the IDL change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification Standard could be clearer good first issue Ideal for someone new to a WHATWG standard or software project topic: canvas
Development

Successfully merging a pull request may close this issue.

3 participants