Skip to content

Queue a task to resolve createImageBitmap #11327

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

Merged
merged 4 commits into from
May 26, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 32 additions & 57 deletions source
Original file line number Diff line number Diff line change
@@ -113967,11 +113967,10 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
<p>This <span>task source</span> is used for features that react to user interaction, for
example keyboard or mouse input.</p>

<p>Events sent in response to user input (e.g. <code
data-x="event-click">click</code> events) must be fired using <span
data-x="concept-task">tasks</span> <span data-x="queue a task">queued</span> with the <span>user
interaction task source</span>. <ref>UIEVENTS</ref></p> <!-- user
interaction events integration point -->
<p>Events sent in response to user input (e.g., <code data-x="event-click">click</code> events)
must be fired using <span data-x="concept-task">tasks</span> <span data-x="queue a
task">queued</span> with the <span>user interaction task source</span>. <ref>UIEVENTS</ref></p>
<!-- user interaction events integration point -->
</dd>

<dt>The <dfn export>networking task source</dfn></dt>
@@ -113992,7 +113991,7 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
<dt>The <dfn>rendering task source</dfn></dt>

<dd>
<p>This <span>task source</span> is used solely to <span>update the rendering</span>.
<p>This <span>task source</span> is used solely to <span>update the rendering</span>.</p>
</dd>
</dl>

@@ -118978,6 +118977,9 @@ dictionary <dfn dictionary>ImageBitmapOptions</dfn> {

<hr>

<p>The <span data-x="dom-createImageBitmap">createImageBitmap</span> method uses the <dfn>bitmap
task source</dfn> to settle its returned Promise.</p>

<p>The <dfn method for="WindowOrWorkerGlobalScope"><code
data-x="dom-createImageBitmap">createImageBitmap(<var>image</var>,
<var>options</var>)</code></dfn> and <code data-x="">createImageBitmap(<var>image</var>,
@@ -118999,7 +119001,7 @@ dictionary <dfn dictionary>ImageBitmapOptions</dfn> {
exception or returns <i>bad</i>, then return <span>a promise rejected with</span> an
<span>"<code>InvalidStateError</code>"</span> <code>DOMException</code>.

<li><p>Let <var>p</var> be a new promise.</p></li>
<li><p>Let <var>promise</var> be a new promise.</p></li>

<li><p>Let <var>imageBitmap</var> be a new <code>ImageBitmap</code> object.</p></li>

@@ -119036,13 +119038,8 @@ dictionary <dfn dictionary>ImageBitmapOptions</dfn> {
data-x="concept-canvas-origin-clean">origin-clean</span> flag of <var>imageBitmap</var>'s
bitmap to false.</p></li>

<li>
<p>Run this step <span>in parallel</span>:</p>

<ol>
<li><p>Resolve <var>p</var> with <var>imageBitmap</var>.</p></li>
</ol>
</li>
<li><p><span>Queue a global task</span>, using the <span>bitmap task source</span>, to
resolve <var>promise</var> with <var>imageBitmap</var>.</p></li>
</ol>
</dd>

@@ -119065,13 +119062,8 @@ dictionary <dfn dictionary>ImageBitmapOptions</dfn> {
data-x="concept-canvas-origin-clean">origin-clean</span> flag of <var>imageBitmap</var>'s
bitmap to false.</p></li>

<li>
<p>Run this step <span>in parallel</span>:</p>

<ol>
<li><p>Resolve <var>p</var> with <var>imageBitmap</var>.</p></li>
</ol>
</li>
<li><p><span>Queue a global task</span>, using the <span>bitmap task source</span>, to
resolve <var>promise</var> with <var>imageBitmap</var>.</p></li>
</ol>
</dd>

@@ -119088,13 +119080,8 @@ dictionary <dfn dictionary>ImageBitmapOptions</dfn> {
data-x="concept-canvas-origin-clean">origin-clean</span> flag of <var>image</var>'s
bitmap.</p></li>

<li>
<p>Run this step <span>in parallel</span>:</p>

<ol>
<li><p>Resolve <var>p</var> with <var>imageBitmap</var>.</p></li>
</ol>
</li>
<li><p><span>Queue a global task</span>, using the <span>bitmap task source</span>, to
resolve <var>promise</var> with <var>imageBitmap</var>.</p></li>
</ol>
</dd>

@@ -119104,9 +119091,10 @@ dictionary <dfn dictionary>ImageBitmapOptions</dfn> {

<ol>
<li><p>Let <var>imageData</var> be the result of reading <var>image</var>'s data. If an <span
data-x="file-error-read">error occurs during reading of the object</span>, then reject
<var>p</var> with an <span>"<code>InvalidStateError</code>"</span> <code>DOMException</code>
and abort these steps.</p></li>
data-x="file-error-read">error occurs during reading of the object</span>, then <span>queue a
global task</span>, using the <span>bitmap task source</span>, to reject <var>promise</var>
with an <span>"<code>InvalidStateError</code>"</span> <code>DOMException</code> and abort
these steps.</p></li>

<li><p>Apply the <span data-x="Content-Type sniffing: image">image sniffing rules</span> to
determine the file format of <var>imageData</var>, with MIME type of <var>image</var> (as
@@ -119115,9 +119103,10 @@ dictionary <dfn dictionary>ImageBitmapOptions</dfn> {

<li><p>If <var>imageData</var> is not in a supported image file format (e.g., it's not an
image at all), or if <var>imageData</var> is corrupted in some fatal way such that the image
dimensions cannot be obtained (e.g., a vector graphic with no natural size), then reject
<var>p</var> with an <span>"<code>InvalidStateError</code>"</span> <code>DOMException</code>
and abort these steps.</p></li>
dimensions cannot be obtained (e.g., a vector graphic with no natural size), then <span>queue
a global task</span>, using the <span>bitmap task source</span>, to reject <var>promise</var>
with an <span>"<code>InvalidStateError</code>"</span> <code>DOMException</code> and abort
these steps.</p></li>

<li><p>Set <var>imageBitmap</var>'s <span data-x="concept-ImageBitmap-bitmap-data">bitmap
data</span> to <var>imageData</var>, <span>cropped to the source rectangle with
@@ -119127,7 +119116,8 @@ dictionary <dfn dictionary>ImageBitmapOptions</dfn> {
is not supported or is disabled), or, if there is no such image, the first frame of the
animation.</p></li>

<li><p>Resolve <var>p</var> with <var>imageBitmap</var>.</p></li>
<li><p><span>Queue a global task</span>, using the <span>bitmap task source</span>, to
resolve <var>promise</var> with <var>imageBitmap</var>.</p></li>
</ol>
</dd>

@@ -119146,13 +119136,8 @@ dictionary <dfn dictionary>ImageBitmapOptions</dfn> {
data</span> to <var>image</var>'s image data, <span>cropped to the source rectangle with
formatting</span>.</p></li>

<li>
<p>Run this step <span>in parallel</span>:</p>

<ol>
<li><p>Resolve <var>p</var> with <var>imageBitmap</var>.</p></li>
</ol>
</li>
<li><p><span>Queue a global task</span>, using the <span>bitmap task source</span>, to
resolve <var>promise</var> with <var>imageBitmap</var>.</p></li>
</ol>
</dd>

@@ -119169,13 +119154,8 @@ dictionary <dfn dictionary>ImageBitmapOptions</dfn> {
data-x="concept-canvas-origin-clean">origin-clean</span> flag of <var>image</var>'s
bitmap.</p></li>

<li>
<p>Run this step <span>in parallel</span>:</p>

<ol>
<li><p>Resolve <var>p</var> with <var>imageBitmap</var>.</p></li>
</ol>
</li>
<li><p><span>Queue a global task</span>, using the <span>bitmap task source</span>, to
resolve <var>promise</var> with <var>imageBitmap</var>.</p></li>
</ol>
</dd>

@@ -119186,19 +119166,14 @@ dictionary <dfn dictionary>ImageBitmapOptions</dfn> {
data</span> to a copy of <var>image</var>'s visible pixel data, <span>cropped to the source
rectangle with formatting</span>.</p></li>

<li>
<p>Run this step <span>in parallel</span>:</p>

<ol>
<li><p>Resolve <var>p</var> with <var>imageBitmap</var>.</p></li>
</ol>
</li>
<li><p><span>Queue a global task</span>, using the <span>bitmap task source</span>, to
resolve <var>promise</var> with <var>imageBitmap</var>.</p></li>
</ol>
</dd>
</dl>
</li>

<li><p>Return <var>p</var>.</p></li>
<li><p>Return <var>promise</var>.</p></li>
</ol>

<p>When the steps above require that the user agent <dfn data-x="cropped to the source