mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibWeb: Add FontFaceSetLoadEvent
This commit is contained in:
committed by
Jelle Raaijmakers
parent
581d6ce6e7
commit
2ff77589df
Notes:
github-actions[bot]
2026-01-06 11:25:43 +00:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/2ff77589dfc Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7328 Reviewed-by: https://github.com/gmta ✅
49
Libraries/LibWeb/CSS/FontFaceSetLoadEvent.cpp
Normal file
49
Libraries/LibWeb/CSS/FontFaceSetLoadEvent.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2026, Tim Ledbetter <tim.ledbetter@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/FontFaceSetLoadEventPrototype.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/CSS/FontFace.h>
|
||||
#include <LibWeb/CSS/FontFaceSetLoadEvent.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
GC_DEFINE_ALLOCATOR(FontFaceSetLoadEvent);
|
||||
|
||||
GC::Ref<FontFaceSetLoadEvent> FontFaceSetLoadEvent::create(JS::Realm& realm, FlyString const& event_name, FontFaceSetLoadEventInit const& event_init)
|
||||
{
|
||||
return realm.create<FontFaceSetLoadEvent>(realm, event_name, event_init);
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/css-font-loading/#dom-fontfacesetloadevent-fontfacesetloadevent
|
||||
WebIDL::ExceptionOr<GC::Ref<FontFaceSetLoadEvent>> FontFaceSetLoadEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, FontFaceSetLoadEventInit const& event_init)
|
||||
{
|
||||
return create(realm, event_name, event_init);
|
||||
}
|
||||
|
||||
FontFaceSetLoadEvent::FontFaceSetLoadEvent(JS::Realm& realm, FlyString const& event_name, CSS::FontFaceSetLoadEventInit const& event_init)
|
||||
: DOM::Event(realm, event_name, event_init)
|
||||
{
|
||||
m_fontfaces.ensure_capacity(event_init.fontfaces.size());
|
||||
for (auto const& font_face : event_init.fontfaces) {
|
||||
VERIFY(font_face);
|
||||
m_fontfaces.unchecked_append(*font_face);
|
||||
}
|
||||
}
|
||||
|
||||
void FontFaceSetLoadEvent::initialize(JS::Realm& realm)
|
||||
{
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(FontFaceSetLoadEvent);
|
||||
Base::initialize(realm);
|
||||
}
|
||||
|
||||
void FontFaceSetLoadEvent::visit_edges(Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_fontfaces);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user