@@ -25403,6 +25403,7 @@ interface <dfn>HTMLSourceElement</dfn> : <span>HTMLElement</span> {
25403
25403
<dd><code data-x="attr-dim-width">width</code></dd>
25404
25404
<dd><code data-x="attr-dim-height">height</code></dd>
25405
25405
<dd><code data-x="attr-img-referrerpolicy">referrerpolicy</code></dd>
25406
+ <dd><code data-x="attr-img-decoding">decoding</code></dd>
25406
25407
<dt><span data-x="concept-element-dom">DOM interface</span>:</dt>
25407
25408
<dd w-nodev>
25408
25409
<pre class="idl">[Exposed=Window,
@@ -25423,6 +25424,7 @@ interface <dfn>HTMLImageElement</dfn> : <span>HTMLElement</span> {
25423
25424
readonly attribute boolean <span data-x="dom-img-complete">complete</span>;
25424
25425
readonly attribute USVString <span data-x="dom-img-currentSrc">currentSrc</span>;
25425
25426
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-img-referrerPolicy">referrerPolicy</span>;
25427
+ [<span>CEReactions</span>] attribute DOMString <span data-x="dom-img-decoding">decoding</span>;
25426
25428
25427
25429
Promise<void> <span data-x="dom-img-decode">decode</span>();
25428
25430
};</pre>
@@ -25492,6 +25494,12 @@ interface <dfn>HTMLImageElement</dfn> : <span>HTMLElement</span> {
25492
25494
<span>referrer policy attribute</span>. Its purpose is to set the <span>referrer policy</span>
25493
25495
used when <span data-x="concept-fetch">fetching</span> the image. <ref spec=REFERRERPOLICY></p>
25494
25496
25497
+ <p>The <dfn data-x="attr-img-decoding"><code>decoding</code></dfn> attribute indicates the
25498
+ preferred method to <span data-x="img-decoding-process">decode</span> this image. The attribute,
25499
+ if present, must be an <span>image decoding hint</span>. This attribute's <i data-x="missing value
25500
+ default">missing value default</i> and <i data-x="invalid value default">invalid value
25501
+ default</i> are both the <span data-x="attr-img-decoding-auto-state">auto</span> state.</p>
25502
+
25495
25503
<hr>
25496
25504
25497
25505
<p>The <code>img</code> element must not be used as a layout tool. In particular, <code>img</code>
@@ -25676,6 +25684,10 @@ interface <dfn>HTMLImageElement</dfn> : <span>HTMLElement</span> {
25676
25684
<span>reflect</span> the <code data-x="attr-img-referrerpolicy">referrerpolicy</code>
25677
25685
content attribute, <span>limited to only known values</span>.</p>
25678
25686
25687
+ <p>The <dfn><code data-x="dom-img-decoding">decoding</code></dfn> IDL attribute must
25688
+ <span>reflect</span> the <code data-x="attr-img-decoding">decoding</code> content
25689
+ attribute, <span>limited to only known values</span>.
25690
+
25679
25691
</div>
25680
25692
25681
25693
<dl class="domintro">
@@ -25723,17 +25735,20 @@ interface <dfn>HTMLImageElement</dfn> : <span>HTMLElement</span> {
25723
25735
25724
25736
</dd>
25725
25737
25726
- <dt><var>image</var> . <code subdfn data-x="dom-img-decode">decode </code>() </dt>
25738
+ <dt><var>image</var> . <code subdfn data-x="dom-img-decoding">decoding </code></dt>
25727
25739
25728
25740
<dd>
25729
25741
25730
- <p>Images usually exist in some encoded form; user agents need to decode them into raw pixels
25731
- before displaying them. This process can be relatively expensive.</p>
25742
+ <p>Returns the <span>image decoding hint</span> set for this image.</p>
25743
+
25744
+ </dd>
25745
+
25746
+ <dt><var>image</var> . <code subdfn data-x="dom-img-decode">decode</code>()</dt>
25732
25747
25733
- <p>This method causes the user agent to decode the image <span>in parallel</span>, returning a
25734
- promise that fulfills when decoding is complete. The decoded image data will then be readily
25735
- available for at least one frame after the fulfillment, ensuring that attempting to display the
25736
- image will complete without decoding delay .</p>
25748
+ <dd>
25749
+
25750
+ <p>This method causes the user agent to <span data-x="img-decoding-process">decode</span> the
25751
+ image <span>in parallel</span>, returning a promise that fulfills when decoding is complete .</p>
25737
25752
25738
25753
<p>The promise will be rejected with an <span>"<code>EncodingError</code>"</span>
25739
25754
<code>DOMException</code> if the image cannot be decoded.</p>
@@ -25869,8 +25884,7 @@ img.decode();</pre>
25869
25884
available</span></dt>
25870
25885
25871
25886
<dd>
25872
- <p>Decode the image's media data entirely into its bitmap form, suitable for rapid painting
25873
- to the screen.</p>
25887
+ <p><span data-x="img-decoding-process">Decode</span> the image.</p>
25874
25888
25875
25889
<p>If decoding does not need to be performed for this image (for example because it is a
25876
25890
vector graphic), resolve <var>promise</var> with undefined.</p>
@@ -27021,6 +27035,70 @@ was an English <a href="/wiki/Music_hall">music hall</a> singer, ...</pre>
27021
27035
images</span> but could keep the image data separately, and use that if the server responds with a
27022
27036
<code data-x="">304 Not Modified</code> status.</p>
27023
27037
27038
+ <h6>Decoding images</h6>
27039
+
27040
+ <p>Image data is usually encoded in order to reduce file size. This means that in order for the
27041
+ user agent to present the image to the screen, the data needs to be decoded.
27042
+ <dfn data-x="img-decoding-process">Decoding</dfn> is the process which converts an image's media
27043
+ data into a bitmap form, suitable for presentation to the screen. Note that this process can be
27044
+ slow relative to other processes involved in presenting content. Thus, the user agent can choose
27045
+ when to perform decoding, in order to create the best user experience.</p>
27046
+
27047
+ <p>Image decoding is said to be synchronous if it prevents presentation of other content until it
27048
+ is finished. Typically, this has an effect of atomically presenting the image and any other
27049
+ content at the same time. However, this presentation is delayed by the amount of time it takes to
27050
+ perform the decode.</p>
27051
+
27052
+ <p>Image decoding is said to be asynchronous if it does not prevent presentation of other content.
27053
+ This has an effect of presenting non-image content faster. However, the image content is missing
27054
+ on screen until the decode finishes. Once the decode is finished, the screen is updated with the
27055
+ image.</p>
27056
+
27057
+ <p>In both synchronous and asynchronous decoding modes, the final content is presented to screen
27058
+ after the same amount of time has elapsed. The main difference is whether the user agent presents
27059
+ non-image content ahead of presenting the final content.</p>
27060
+
27061
+ <p>In order to aid the user agent in deciding whether to perform synchronous or asynchronous
27062
+ decode, the <code data-x="attr-img-decoding">decoding</code> attribute can be set on
27063
+ <code>img</code> elements. The possible values of of the <code
27064
+ data-x="attr-img-decoding">decoding</code> attribute are the following <dfn>image decoding
27065
+ hint</dfn> keywords:</p>
27066
+
27067
+ <table>
27068
+ <thead>
27069
+ <tr>
27070
+ <th>Keyword
27071
+ <th>State
27072
+ <th>Description
27073
+ <tbody>
27074
+ <tr>
27075
+ <td><dfn><code data-x="attr-img-decoding-sync">sync</code></dfn>
27076
+ <td><dfn data-x="attr-img-decoding-sync-state">Sync</dfn>
27077
+ <td>Indicates a preference to <span data-x="img-decoding-process">decode</span> this image
27078
+ synchronously for atomic presentation with other content.
27079
+ <tr>
27080
+ <td><dfn><code data-x="attr-img-decoding-async">async</code></dfn>
27081
+ <td><dfn data-x="attr-img-decoding-async-state">Async</dfn>
27082
+ <td>Indicates a preference to <span data-x="img-decoding-process">decode</span> this image
27083
+ asynchronously to avoid delaying presentation of other content.
27084
+ <tr>
27085
+ <td><dfn><code data-x="attr-img-decoding-auto">auto</code></dfn>
27086
+ <td><dfn data-x="attr-img-decoding-auto-state">Auto</dfn>
27087
+ <td>Indicates no preference in decoding mode (the default).
27088
+ </table>
27089
+
27090
+ <p>When <span data-x="img-decoding-process">decoding</span> an image, the user agent should
27091
+ respect the preference indicated by the <code data-x="attr-img-decoding">decoding</code>
27092
+ attribute's state. If the state indicated is <span
27093
+ data-x="attr-img-decoding-auto-state">auto</span>, then the user agent is free to choose any
27094
+ decoding behavior.</p>
27095
+
27096
+ <p class="note">It is also possible to control the decoding behavior using the <code
27097
+ data-x="dom-img-decode">decode()</code> method. Since the <code
27098
+ data-x="dom-img-decode">decode()</code> method performs <span
27099
+ data-x="img-decoding-process">decoding</span> independently from the process responsible for
27100
+ presenting content to screen, it is unaffected by the <code
27101
+ data-x="attr-img-decoding">decoding</code> attribute.</p>
27024
27102
27025
27103
<h6>Updating the image data</h6>
27026
27104
@@ -115915,6 +115993,7 @@ interface <dfn>External</dfn> {
115915
115993
<code data-x="attr-img-ismap">ismap</code>;
115916
115994
<code data-x="attr-dim-width">width</code>;
115917
115995
<code data-x="attr-dim-height">height</code>;
115996
+ <code data-x="attr-img-decoding">decoding</code>;
115918
115997
<code data-x="attr-img-referrerpolicy">referrerpolicy</code></td>
115919
115998
<td><code>HTMLImageElement</code></td>
115920
115999
</tr>
@@ -117469,6 +117548,13 @@ interface <dfn>External</dfn> {
117469
117548
<span>valid week string</span>,
117470
117549
<span>valid non-negative integer</span>, or
117471
117550
<span>valid duration string</span>
117551
+ <tr>
117552
+ <th> <code data-x="">decoding</code>
117553
+ <td> <code data-x="attr-img-decoding">img</code>
117554
+ <td> Decoding hint to use when processing this image for presentation
117555
+ <td> "<code data-x="attr-img-decoding-sync">sync</code>";
117556
+ "<code data-x="attr-img-decoding-async">async</code>";
117557
+ "<code data-x="attr-img-decoding-auto">auto</code>"
117472
117558
<tr>
117473
117559
<th> <code data-x="">default</code>
117474
117560
<td> <code data-x="attr-track-default">track</code>
0 commit comments