1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-29 03:42:07 +00:00

LibWeb: Implement WindowEventHandlers

This commit is contained in:
Luke Wilde 2022-06-27 19:48:54 +01:00 committed by Linus Groh
parent ebf2184636
commit 3fe66bddf4
15 changed files with 186 additions and 9 deletions

View file

@ -0,0 +1,28 @@
/*
* 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(Optional<Bindings::CallbackType> value) \
{ \
window_event_handlers_to_event_target().set_event_handler_attribute(event_name, move(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;
}