diff --git a/Userland/Libraries/LibWeb/CSS/FontFaceSet.cpp b/Userland/Libraries/LibWeb/CSS/FontFaceSet.cpp index cfd0dcafd5c..4e6ee21f5db 100644 --- a/Userland/Libraries/LibWeb/CSS/FontFaceSet.cpp +++ b/Userland/Libraries/LibWeb/CSS/FontFaceSet.cpp @@ -109,6 +109,18 @@ WebIDL::CallbackType* FontFaceSet::onloadingdone() return event_handler_attribute(HTML::EventNames::loadingdone); } +// https://drafts.csswg.org/css-font-loading/#dom-fontfaceset-onloadingerror +void FontFaceSet::set_onloadingerror(WebIDL::CallbackType* event_handler) +{ + set_event_handler_attribute(HTML::EventNames::loadingerror, event_handler); +} + +// https://drafts.csswg.org/css-font-loading/#dom-fontfaceset-onloadingerror +WebIDL::CallbackType* FontFaceSet::onloadingerror() +{ + return event_handler_attribute(HTML::EventNames::loadingerror); +} + // https://drafts.csswg.org/css-font-loading/#dom-fontfaceset-load JS::ThrowCompletionOr> FontFaceSet::load(String const&, String const&) { diff --git a/Userland/Libraries/LibWeb/CSS/FontFaceSet.h b/Userland/Libraries/LibWeb/CSS/FontFaceSet.h index a4bc69a4734..0916c96e81d 100644 --- a/Userland/Libraries/LibWeb/CSS/FontFaceSet.h +++ b/Userland/Libraries/LibWeb/CSS/FontFaceSet.h @@ -35,6 +35,8 @@ public: WebIDL::CallbackType* onloading(); void set_onloadingdone(WebIDL::CallbackType*); WebIDL::CallbackType* onloadingdone(); + void set_onloadingerror(WebIDL::CallbackType*); + WebIDL::CallbackType* onloadingerror(); JS::ThrowCompletionOr> load(String const& font, String const& text); diff --git a/Userland/Libraries/LibWeb/CSS/FontFaceSet.idl b/Userland/Libraries/LibWeb/CSS/FontFaceSet.idl index 3633e81b948..817b9e6fe03 100644 --- a/Userland/Libraries/LibWeb/CSS/FontFaceSet.idl +++ b/Userland/Libraries/LibWeb/CSS/FontFaceSet.idl @@ -27,7 +27,7 @@ interface FontFaceSet : EventTarget { // events for when loading state changes attribute EventHandler onloading; attribute EventHandler onloadingdone; - [FIXME] attribute EventHandler onloadingerror; + attribute EventHandler onloadingerror; // check and start loads if appropriate // and fulfill promise when all loads complete diff --git a/Userland/Libraries/LibWeb/HTML/EventNames.h b/Userland/Libraries/LibWeb/HTML/EventNames.h index 83347232711..02990c52797 100644 --- a/Userland/Libraries/LibWeb/HTML/EventNames.h +++ b/Userland/Libraries/LibWeb/HTML/EventNames.h @@ -67,6 +67,7 @@ namespace Web::HTML::EventNames { __ENUMERATE_HTML_EVENT(loadedmetadata) \ __ENUMERATE_HTML_EVENT(loading) \ __ENUMERATE_HTML_EVENT(loadingdone) \ + __ENUMERATE_HTML_EVENT(loadingerror) \ __ENUMERATE_HTML_EVENT(loadstart) \ __ENUMERATE_HTML_EVENT(message) \ __ENUMERATE_HTML_EVENT(messageerror) \