diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp
index e920932ce75..53df9e647e3 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp
@@ -1145,4 +1145,30 @@ void HTMLImageElement::animate()
paintable()->set_needs_display();
}
+StringView HTMLImageElement::decoding() const
+{
+ switch (m_decoding_hint) {
+ case ImageDecodingHint::Sync:
+ return "sync"sv;
+ case ImageDecodingHint::Async:
+ return "async"sv;
+ case ImageDecodingHint::Auto:
+ return "auto"sv;
+ default:
+ VERIFY_NOT_REACHED();
+ }
+}
+
+void HTMLImageElement::set_decoding(String decoding)
+{
+ if (decoding == "sync"sv) {
+ dbgln("FIXME: HTMLImageElement.decoding = 'sync' is not implemented yet");
+ m_decoding_hint = ImageDecodingHint::Sync;
+ } else if (decoding == "async"sv) {
+ dbgln("FIXME: HTMLImageElement.decoding = 'async' is not implemented yet");
+ m_decoding_hint = ImageDecodingHint::Async;
+ } else
+ m_decoding_hint = ImageDecodingHint::Auto;
+}
+
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h
index 668b16b1fd9..6258cc09078 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h
@@ -80,6 +80,10 @@ public:
// https://html.spec.whatwg.org/multipage/images.html#select-an-image-source
[[nodiscard]] Optional select_an_image_source();
+ StringView decoding() const;
+
+ void set_decoding(String);
+
void set_source_set(SourceSet);
ImageRequest& current_request() { return *m_current_request; }
@@ -147,6 +151,15 @@ private:
SourceSet m_source_set;
CSSPixelSize m_last_seen_viewport_size;
+
+ // https://html.spec.whatwg.org/multipage/images.html#image-decoding-hint
+ enum class ImageDecodingHint {
+ Auto,
+ Sync,
+ Async
+ };
+
+ ImageDecodingHint m_decoding_hint = ImageDecodingHint::Auto;
};
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.idl
index c5ba81ba259..fa216b581a1 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.idl
+++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.idl
@@ -22,7 +22,7 @@ interface HTMLImageElement : HTMLElement {
readonly attribute boolean complete;
readonly attribute USVString currentSrc;
[CEReactions, Reflect=referrerpolicy, Enumerated=ReferrerPolicy] attribute DOMString referrerPolicy;
- [FIXME, CEReactions] attribute DOMString decoding;
+ [CEReactions] attribute DOMString decoding;
[CEReactions, Enumerated=LazyLoadingAttribute, Reflect] attribute DOMString loading;
[CEReactions, Enumerated=FetchPriorityAttribute, Reflect=fetchpriority] attribute DOMString fetchPriority;