summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/EventHandler.cpp
blob: e6d5b26b7f805de45b4e22ecd708811fa0c5af7e (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
29
30
31
/*
 * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include <LibWeb/DOM/DOMEventListener.h>
#include <LibWeb/HTML/EventHandler.h>

namespace Web::HTML {

EventHandler::EventHandler(DeprecatedString s)
    : value(move(s))
{
}

EventHandler::EventHandler(WebIDL::CallbackType& c)
    : value(&c)
{
}

void EventHandler::visit_edges(Cell::Visitor& visitor)
{
    Base::visit_edges(visitor);
    visitor.visit(listener);

    if (auto* callback = value.get_pointer<JS::GCPtr<WebIDL::CallbackType>>())
        visitor.visit(*callback);
}

}