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

Add ImageBitmapOptions to ImageBitmap's spec #741

Closed
wants to merge 1 commit into from

Conversation

xidachen
Copy link
Contributor

This change adds ImageBitmapOptions to the ImageBitmap spec. The original proposal for ImageBitmapOptions can be found here: https://wiki.whatwg.org/wiki/ImageBitmap_Options.

@@ -89418,10 +89418,19 @@ typedef (<span>HTMLImageElement</span> or
<span>CanvasRenderingContext2D</span> or
<span>ImageBitmap</span>) <dfn>ImageBitmapSource</dfn>;

enum ImageOrientation { "none", "flipY" };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<dfn>s around ImageOrientation, PremultiplyAlpha, and ColorspaceConversion at their definition sites (these next three lines)

<span>s around them at their usage sites (inside the dictionary)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@domenic
Copy link
Member

domenic commented Feb 26, 2016

Overall looking pretty reasonable on a technical level, especially given how this feature has been vetted through discussions on the wiki for a long time. Just lots of little editorial awesomeness of the HTML spec for you to get used to :).

Don't forget to add your name to the acknowledgments!!

@xidachen xidachen force-pushed the ImageBitmapSpecEditing branch from ca66e68 to e97c31e Compare February 26, 2016 15:11
enum <dfn>ColorspaceConversion</dfn> { "<span data-x="dom-ColorspaceConversion-none">none</span>", "<span data-x="dom-ColorspaceConversion-default">default</span>" };

dictionary <dfn>ImageBitmapOptions</dfn> {
<span>ImageOrientation</span> <span data-x="dom-ImageBitmapOptions-imageOrientation">imageOrientation</span> = "<code data-x="dom-ImageOrientation-none">none</code>";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

span, not code; we are already inside a <pre>, and the code makes them orange.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@domenic
Copy link
Member

domenic commented Feb 26, 2016

Done with another round of review. I imagine this will be the last one and then I can merge. Yay!

@domenic domenic self-assigned this Feb 26, 2016
@domenic domenic added the addition/proposal New features or enhancements label Feb 26, 2016
@domenic
Copy link
Member

domenic commented Feb 26, 2016

@xidachen not sure if you are still working, but just wanted to let you know that despite all the "Done" emails, you don't seem to have uploaded the new commit ^_^

@xidachen xidachen force-pushed the ImageBitmapSpecEditing branch 2 times, most recently from 807dda4 to eeb060e Compare February 28, 2016 02:12
@xidachen
Copy link
Contributor Author

@annevk Thank you for your comments. I have made changes in the latest commit. Please review.

@annevk
Copy link
Member

annevk commented Feb 28, 2016

Here we have a subdfn data-x="dom-createImageBitmap", if I break into two lines, should I have one subdfn for each line? That seems would complicate things. In the latest commit, I merge these two lines into one, but if we would prefer two lines, maybe we could have one line with subdfn and the other line doesn't?

I checked for precedent and the first line should have the subdfn. I still think it would be better to have two lines, since IDL has them too.

<ref spec=EXIF></p>

<p>If the value of the <dfn><code data-x="dom-ImageBitmapOptions-colorspaceConversion">
colorspaceConversion</code></dfn> member of <var>options</var> is
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You cannot wrap directly after a start tag as that introduces whitespace between the start of the element and its contents. You'll need to wrap at data-x, even though that makes the first line short.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@annevk
Copy link
Member

annevk commented Feb 28, 2016

Something else, I don't really understand how the additional requirements fit into the constructor algorithm. Currently the algorithm is just a big <dl>. How do these new steps fit in?

Unless I missed something it seems like you added some paragraphs below, but that doesn't really work. The createImageBitmap() needs to be a coherent whole.

@xidachen xidachen force-pushed the ImageBitmapSpecEditing branch from 567dd66 to 27cba12 Compare February 28, 2016 21:42
@annevk
Copy link
Member

annevk commented Feb 29, 2016

Yeah, something like that. Perhaps renaming "crop bitmap data to the source rectangle" to something more generic and adding these paragraphs as new steps at the end of that algorithm would be best.

@xidachen xidachen force-pushed the ImageBitmapSpecEditing branch from 27cba12 to c665107 Compare February 29, 2016 14:03
@xidachen
Copy link
Contributor Author

Yes, that makes more sense and is cleaner. I rename it to "crop bitmap data to the source rectangle with formatting", does that sound good?

@annevk
Copy link
Member

annevk commented Feb 29, 2016

I think that's fine. This looks a lot better already.

@xidachen xidachen force-pushed the ImageBitmapSpecEditing branch 3 times, most recently from c546193 to 9530327 Compare February 29, 2016 15:45
Promise&lt;ImageBitmap&gt; <span data-x="dom-createImageBitmap">createImageBitmap</span>(<span>ImageBitmapSource</span> image);
Promise&lt;ImageBitmap&gt; <span data-x="dom-createImageBitmap">createImageBitmap</span>(<span>ImageBitmapSource</span> image, long sx, long sy, long sw, long sh);
Promise&lt;ImageBitmap&gt; <span data-x="dom-createImageBitmap">createImageBitmap</span>(<span>ImageBitmapSource</span> image, optional <span>ImageBitmapOptions</span> options);
Promise&lt;ImageBitmap&gt; <span data-x="dom-createImageBitmap">createImageBitmap</span>(<span>ImageBitmapSource</span> image, long sx, long sy, long sw, long sh, optional <span>ImageBitmapOptions</span> options);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noticed that this overflows onto two lines. Could we move optional ImageBitmapOptions options onto a second line? Aligned with enough leading space so that it lines up with ImageBitmapSource on the above line.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we shouldn't wrap IDL.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I guess we don't do that in this spec. I was reading some CSSWG specs this morning that did. OK.

@xidachen xidachen force-pushed the ImageBitmapSpecEditing branch from 9530327 to fd32bc9 Compare February 29, 2016 17:01
<p>If <var>image</var> is an <code>img</code> element or a <code>Blob</code> object, let
<var>val</var> be the value of the <dfn><code
data-x="dom-ImageBitmapOptions-colorspaceConversion">colorspaceConversion</code></dfn> member
of <var>options</var>, run these substeps:</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and then run these substeps*

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@xidachen xidachen force-pushed the ImageBitmapSpecEditing branch from fd32bc9 to 38f377e Compare February 29, 2016 18:13

<p>Let <var>val</var> be the value of <dfn><code
data-x="dom-ImageBitmapOptions-premultiplyAlpha">premultiplyAlpha</code></dfn> member of
<var>options</var>, run these substeps:</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"and then" run these substeps.

@domenic
Copy link
Member

domenic commented Feb 29, 2016

This LGTM with one nit that we can fix while merging if necessary. Will turn over to @annevk for his sign-off additionally.

@domenic domenic assigned annevk and unassigned domenic Feb 29, 2016
annevk pushed a commit that referenced this pull request Mar 1, 2016
This change allows for flipping images vertically (ignoring EXIF data), disabling colorspace
conversion, and control over whether or not to premultiply by alpha.

PR: #741
@annevk
Copy link
Member

annevk commented Mar 1, 2016

Thank you Xida! Great contribution. Landed as 49f9e04. (I changed the commit message, made @domenic's requested change, and made sure that the value inside Promise<> would be linked.)

@annevk annevk closed this Mar 1, 2016
@xidachen
Copy link
Contributor Author

xidachen commented Mar 1, 2016

Thank you so much @domenic @annevk for reviewing this change and merging. I really appreciate your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements
Development

Successfully merging this pull request may close these issues.

3 participants