Implement 'decoding' attribute on HTMLImageElement #6636
+149
−81
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
sync Mode
the image and any other content at the same time. However, this presentation is delayed by the amount of time it takes to perform the decode."
execution and rendering updates. It waits in a tight loop until the image decoding process, running on a separate thread, completes (either successfully or with a failure).
This blocking behavior directly matches the specification's requirement to "prevent presentation of other content until it is finished," thereby achieving an atomic
presentation.
async Mode
the image content is missing on screen until the decode finishes."
Web::Platform::ImageCodecPlugin::the().decode_image(), which is an asynchronous operation. Callbacks are attached to this operation to resolve or reject the promise when the
decoding is complete. This entire process does not block the main thread, allowing the browser's rendering engine to continue processing and displaying other content on the
page. This aligns perfectly with the spec's definition of asynchronous decoding.
auto Mode
decoding, the implementation prioritizes a non-blocking user experience, which is generally preferred for web performance.