LibWeb/CSS: Implement FontFaceSet.onloadingerror

This commit is contained in:
Jamie Mansfield 2024-06-06 20:02:55 +01:00 committed by Andreas Kling
parent e56e09b820
commit bbd82265e1
Notes: sideshowbarker 2024-07-17 03:19:14 +09:00
4 changed files with 16 additions and 1 deletions

View File

@ -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<JS::NonnullGCPtr<JS::Promise>> FontFaceSet::load(String const&, String const&)
{

View File

@ -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<JS::NonnullGCPtr<JS::Promise>> load(String const& font, String const& text);

View File

@ -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

View File

@ -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) \