mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
LibWeb/CSS: Implement FontFaceSet.onloading
This commit is contained in:
parent
c6a6a7c4f0
commit
4210586730
Notes:
sideshowbarker
2024-07-17 02:21:14 +09:00
Author: https://github.com/jamierocks Commit: https://github.com/LadybirdBrowser/ladybird/commit/4210586730 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/85
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2024, Andrew Kaster <akaster@serenityos.org>
|
||||
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
@ -11,6 +12,7 @@
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/CSS/FontFace.h>
|
||||
#include <LibWeb/CSS/FontFaceSet.h>
|
||||
#include <LibWeb/HTML/EventNames.h>
|
||||
#include <LibWeb/WebIDL/Promise.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
@ -83,6 +85,18 @@ void FontFaceSet::clear()
|
||||
m_set_entries->set_clear();
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/css-font-loading/#dom-fontfaceset-onloading
|
||||
void FontFaceSet::set_onloading(WebIDL::CallbackType* event_handler)
|
||||
{
|
||||
set_event_handler_attribute(HTML::EventNames::loading, event_handler);
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/css-font-loading/#dom-fontfaceset-onloading
|
||||
WebIDL::CallbackType* FontFaceSet::onloading()
|
||||
{
|
||||
return event_handler_attribute(HTML::EventNames::loading);
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/css-font-loading/#dom-fontfaceset-load
|
||||
JS::ThrowCompletionOr<JS::NonnullGCPtr<JS::Promise>> FontFaceSet::load(String const&, String const&)
|
||||
{
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2024, Andrew Kaster <akaster@serenityos.org>
|
||||
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
@ -29,6 +30,10 @@ public:
|
||||
JS::NonnullGCPtr<FontFaceSet> add(JS::Handle<FontFace>);
|
||||
bool delete_(JS::Handle<FontFace>);
|
||||
void clear();
|
||||
|
||||
void set_onloading(WebIDL::CallbackType*);
|
||||
WebIDL::CallbackType* onloading();
|
||||
|
||||
JS::ThrowCompletionOr<JS::NonnullGCPtr<JS::Promise>> load(String const& font, String const& text);
|
||||
|
||||
JS::NonnullGCPtr<JS::Promise> ready() const;
|
||||
|
@ -25,7 +25,7 @@ interface FontFaceSet : EventTarget {
|
||||
undefined clear();
|
||||
|
||||
// events for when loading state changes
|
||||
[FIXME] attribute EventHandler onloading;
|
||||
attribute EventHandler onloading;
|
||||
[FIXME] attribute EventHandler onloadingdone;
|
||||
[FIXME] attribute EventHandler onloadingerror;
|
||||
|
||||
|
@ -65,6 +65,7 @@ namespace Web::HTML::EventNames {
|
||||
__ENUMERATE_HTML_EVENT(loadend) \
|
||||
__ENUMERATE_HTML_EVENT(loadeddata) \
|
||||
__ENUMERATE_HTML_EVENT(loadedmetadata) \
|
||||
__ENUMERATE_HTML_EVENT(loading) \
|
||||
__ENUMERATE_HTML_EVENT(loadstart) \
|
||||
__ENUMERATE_HTML_EVENT(message) \
|
||||
__ENUMERATE_HTML_EVENT(messageerror) \
|
||||
|
Loading…
Reference in New Issue
Block a user