ladybird/Userland/Libraries/LibWeb/HTML/WindowEventHandlers.cpp
Andreas Kling 8cda70c892 LibWeb: Move event listeners, handlers and callbacks to the GC heap
This patch moves the following things to being GC-allocated:
- Bindings::CallbackType
- HTML::EventHandler
- DOM::IDLEventListener
- DOM::DOMEventListener
- DOM::NodeFilter

Note that we only use PlatformObject for things that might be exposed
to web content. Anything that is only used internally inherits directly
from JS::Cell instead, making them a bit more lightweight.
2022-09-06 00:27:09 +02:00

28 lines
1.2 KiB
C++

/*
* Copyright (c) 2022, Luke Wilde <lukew@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/DOM/EventTarget.h>
#include <LibWeb/HTML/EventNames.h>
#include <LibWeb/HTML/WindowEventHandlers.h>
namespace Web::HTML {
#undef __ENUMERATE
#define __ENUMERATE(attribute_name, event_name) \
void WindowEventHandlers::set_##attribute_name(Bindings::CallbackType* value) \
{ \
window_event_handlers_to_event_target().set_event_handler_attribute(event_name, value); \
} \
Bindings::CallbackType* WindowEventHandlers::attribute_name() \
{ \
return window_event_handlers_to_event_target().event_handler_attribute(event_name); \
}
ENUMERATE_WINDOW_EVENT_HANDLERS(__ENUMERATE)
#undef __ENUMERATE
WindowEventHandlers::~WindowEventHandlers() = default;
}