2021-02-03 22:47:50 +01:00
|
|
|
/*
|
2024-10-04 13:19:50 +02:00
|
|
|
* Copyright (c) 2021, Andreas Kling <andreas@ladybird.org>
|
2021-02-03 22:47:50 +01:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2021-02-03 22:47:50 +01:00
|
|
|
*/
|
|
|
|
|
2022-06-27 19:48:54 +01:00
|
|
|
#include <LibWeb/DOM/EventTarget.h>
|
2021-02-03 22:47:50 +01:00
|
|
|
#include <LibWeb/HTML/EventNames.h>
|
|
|
|
#include <LibWeb/HTML/GlobalEventHandlers.h>
|
|
|
|
#include <LibWeb/UIEvents/EventNames.h>
|
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
|
|
|
#undef __ENUMERATE
|
2024-03-10 08:41:18 +01:00
|
|
|
#define __ENUMERATE(attribute_name, event_name) \
|
|
|
|
void GlobalEventHandlers::set_##attribute_name(WebIDL::CallbackType* value) \
|
|
|
|
{ \
|
|
|
|
if (auto event_target = global_event_handlers_to_event_target(event_name)) \
|
|
|
|
event_target->set_event_handler_attribute(event_name, value); \
|
|
|
|
} \
|
|
|
|
WebIDL::CallbackType* GlobalEventHandlers::attribute_name() \
|
|
|
|
{ \
|
|
|
|
if (auto event_target = global_event_handlers_to_event_target(event_name)) \
|
|
|
|
return event_target->event_handler_attribute(event_name); \
|
|
|
|
return nullptr; \
|
2021-02-03 22:47:50 +01:00
|
|
|
}
|
|
|
|
ENUMERATE_GLOBAL_EVENT_HANDLERS(__ENUMERATE)
|
|
|
|
#undef __ENUMERATE
|
|
|
|
|
2022-03-14 13:21:51 -06:00
|
|
|
GlobalEventHandlers::~GlobalEventHandlers() = default;
|
2025-05-13 07:06:33 -04:00
|
|
|
|
2021-02-03 22:47:50 +01:00
|
|
|
}
|