mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-04 07:09:47 +00:00
LibWeb/HTML: Implement CommandEvent
class
This implements the `CommandEvent` class.
This commit is contained in:
parent
ffe0b05abd
commit
cce7d8c0fb
Notes:
github-actions[bot]
2025-04-18 11:11:05 +00:00
Author: https://github.com/skyz1
Commit: cce7d8c0fb
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4220
Reviewed-by: https://github.com/tcl3 ✅
8 changed files with 297 additions and 0 deletions
44
Libraries/LibWeb/HTML/CommandEvent.cpp
Normal file
44
Libraries/LibWeb/HTML/CommandEvent.cpp
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Glenn Skrzypczak <glenn.skrzypczak@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/CommandEventPrototype.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/HTML/CommandEvent.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
GC_DEFINE_ALLOCATOR(CommandEvent);
|
||||
|
||||
GC::Ref<CommandEvent> CommandEvent::create(JS::Realm& realm, FlyString const& event_name, CommandEventInit event_init)
|
||||
{
|
||||
return realm.create<CommandEvent>(realm, event_name, move(event_init));
|
||||
}
|
||||
|
||||
WebIDL::ExceptionOr<GC::Ref<CommandEvent>> CommandEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, CommandEventInit event_init)
|
||||
{
|
||||
return create(realm, event_name, move(event_init));
|
||||
}
|
||||
|
||||
CommandEvent::CommandEvent(JS::Realm& realm, FlyString const& event_name, CommandEventInit event_init)
|
||||
: DOM::Event(realm, event_name, event_init)
|
||||
, m_source(event_init.source)
|
||||
, m_command(move(event_init.command))
|
||||
{
|
||||
}
|
||||
|
||||
void CommandEvent::visit_edges(Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_source);
|
||||
}
|
||||
|
||||
void CommandEvent::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(CommandEvent);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue