summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.cpp
blob: fb394852025e21e1d91e2371b9399ad31b71d8cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
 * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include <LibWeb/DOM/EventTarget.h>
#include <LibWeb/HTML/EventNames.h>
#include <LibWeb/HTML/GlobalEventHandlers.h>
#include <LibWeb/UIEvents/EventNames.h>

namespace Web::HTML {

#undef __ENUMERATE
#define __ENUMERATE(attribute_name, event_name)                                                                 \
    void GlobalEventHandlers::set_##attribute_name(Optional<Bindings::CallbackType> value)                      \
    {                                                                                                           \
        global_event_handlers_to_event_target(event_name).set_event_handler_attribute(event_name, move(value)); \
    }                                                                                                           \
    Bindings::CallbackType* GlobalEventHandlers::attribute_name()                                               \
    {                                                                                                           \
        return global_event_handlers_to_event_target(event_name).event_handler_attribute(event_name);           \
    }
ENUMERATE_GLOBAL_EVENT_HANDLERS(__ENUMERATE)
#undef __ENUMERATE

GlobalEventHandlers::~GlobalEventHandlers() = default;
}