ladybird/Libraries/LibWeb/CSS/FontFaceSetLoadEvent.cpp
Shannon Booth 637fd51595 LibWeb: Unify WebIDL C++ type generation
Represent WebIDL C++ types with a single CppType model that tracks
nullability, optional presence, and contained storage.

GC-like values now use GC::Ref/GC::Ptr directly, while containers choose
"plain", "Root", or "Conservative" container types depending on what
they contain. For example, sequence<Element> becomes a RootVector of
GC::Ref values, while sequence<SomeDictionary> becomes a
ConservativeVector only when the dictionary contains GC-like values.
This moves the generated bindings away from wrapping GC values in
GC::Root by default.

This has broad fallout as the types passed to interfaces for GC
objects changes almost fully across the board.
2026-05-23 18:26:12 +02:00

48 lines
1.5 KiB
C++

/*
* Copyright (c) 2026, Tim Ledbetter <tim.ledbetter@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/FontFaceSetLoadEvent.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, Bindings::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, Bindings::FontFaceSetLoadEventInit const& event_init)
{
return create(realm, event_name, event_init);
}
FontFaceSetLoadEvent::FontFaceSetLoadEvent(JS::Realm& realm, FlyString const& event_name, Bindings::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) {
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);
}
}