mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-11 17:37:33 +02:00
Previously we were inconsistent by generating code for enum definitions but not generating code for dictionaries. With future changes to the IDL generator to expose helpers to convert to and from IDL values this produced circular depdendencies. To solve this problem, also generate the dictionary definitions in bindings headers.
46 lines
1.4 KiB
C++
46 lines
1.4 KiB
C++
/*
|
|
* Copyright (c) 2024, Maciej <sppmacd@pm.me>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibWeb/Bindings/DragEvent.h>
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
|
#include <LibWeb/HTML/DragEvent.h>
|
|
|
|
namespace Web::HTML {
|
|
|
|
GC_DEFINE_ALLOCATOR(DragEvent);
|
|
|
|
GC::Ref<DragEvent> DragEvent::create(JS::Realm& realm, FlyString const& event_name, Bindings::DragEventInit const& event_init, double page_x, double page_y, double offset_x, double offset_y)
|
|
{
|
|
return realm.create<DragEvent>(realm, event_name, event_init, page_x, page_y, offset_x, offset_y);
|
|
}
|
|
|
|
WebIDL::ExceptionOr<GC::Ref<DragEvent>> DragEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, Bindings::DragEventInit const& event_init)
|
|
{
|
|
return create(realm, event_name, event_init, event_init.client_x, event_init.client_y, event_init.client_x, event_init.client_y);
|
|
}
|
|
|
|
DragEvent::DragEvent(JS::Realm& realm, FlyString const& event_name, Bindings::DragEventInit const& event_init, double page_x, double page_y, double offset_x, double offset_y)
|
|
: MouseEvent(realm, event_name, event_init, page_x, page_y, offset_x, offset_y)
|
|
, m_data_transfer(event_init.data_transfer)
|
|
{
|
|
}
|
|
|
|
DragEvent::~DragEvent() = default;
|
|
|
|
void DragEvent::initialize(JS::Realm& realm)
|
|
{
|
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(DragEvent);
|
|
Base::initialize(realm);
|
|
}
|
|
|
|
void DragEvent::visit_edges(JS::Cell::Visitor& visitor)
|
|
{
|
|
Base::visit_edges(visitor);
|
|
visitor.visit(m_data_transfer);
|
|
}
|
|
|
|
}
|