Summary: Allow setting the decoding attribute on img elements to hint at
synchronous/asynchronous decoding of image data. We currently decode images
asynchronously which can cause flickering in some circumstances (e.g. if
the src is changed), while other browsers default to synchronous decoding
(which can block the main thread, but avoid flickering). Implementing this
attribute may allow us to align our behaviour more closely to the group in
the future, without losing the benefit of asynchronous image decoding given
sufficient adoption.
Bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=1416328
Spec:
https://html.spec.whatwg.org/multipage/images.html#image-decoding-hint
Platform coverage: All
Target release: 63
Preference: None
Support in other engines: Safari has already shipped (see
https://bugs.webkit.org/show_bug.cgi?id=179432), Chrome has issued its own
intent to ship/implement but not yet complete (see
https://bugs.chromium.org/p/chromium/issues/detail?id=772470). I haven't
see any commitments from Edge.
Tests: WPT has basic tests verifying attribute enumeration values. The
implementation largely just leverages existing code which can request
synchronous decoding on draw for an image element already.
Secure Context: No. This is already shipping elsewhere outside a secure
context.