-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Conversation
@@ -89418,10 +89418,19 @@ typedef (<span>HTMLImageElement</span> or | |||
<span>CanvasRenderingContext2D</span> or | |||
<span>ImageBitmap</span>) <dfn>ImageBitmapSource</dfn>; | |||
|
|||
enum ImageOrientation { "none", "flipY" }; |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
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!! |
ca66e68
to
e97c31e
Compare
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>"; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Done with another round of review. I imagine this will be the last one and then I can merge. Yay! |
@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 ^_^ |
807dda4
to
eeb060e
Compare
@annevk Thank you for your comments. I have made changes in the latest commit. Please review. |
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Something else, I don't really understand how the additional requirements fit into the constructor algorithm. Currently the algorithm is just a big Unless I missed something it seems like you added some paragraphs below, but that doesn't really work. The |
567dd66
to
27cba12
Compare
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. |
27cba12
to
c665107
Compare
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? |
I think that's fine. This looks a lot better already. |
c546193
to
9530327
Compare
Promise<ImageBitmap> <span data-x="dom-createImageBitmap">createImageBitmap</span>(<span>ImageBitmapSource</span> image); | ||
Promise<ImageBitmap> <span data-x="dom-createImageBitmap">createImageBitmap</span>(<span>ImageBitmapSource</span> image, long sx, long sy, long sw, long sh); | ||
Promise<ImageBitmap> <span data-x="dom-createImageBitmap">createImageBitmap</span>(<span>ImageBitmapSource</span> image, optional <span>ImageBitmapOptions</span> options); | ||
Promise<ImageBitmap> <span data-x="dom-createImageBitmap">createImageBitmap</span>(<span>ImageBitmapSource</span> image, long sx, long sy, long sw, long sh, optional <span>ImageBitmapOptions</span> options); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
9530327
to
fd32bc9
Compare
<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> |
There was a problem hiding this comment.
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*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
fd32bc9
to
38f377e
Compare
|
||
<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> |
There was a problem hiding this comment.
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.
This LGTM with one nit that we can fix while merging if necessary. Will turn over to @annevk for his sign-off additionally. |
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
This change adds ImageBitmapOptions to the ImageBitmap spec. The original proposal for ImageBitmapOptions can be found here: https://wiki.whatwg.org/wiki/ImageBitmap_Options.