Line | Count | Source |
1 | /* | |
2 | * Copyright (c) 2020, the SerenityOS developers. | |
3 | * | |
4 | * SPDX-License-Identifier: BSD-2-Clause | |
5 | */ | |
6 | ||
7 | #pragma once | |
8 | ||
9 | #include <LibWeb/DOM/Event.h> | |
10 | #include <LibWeb/HTML/HTMLElement.h> | |
11 | ||
12 | namespace Web::HTML { | |
13 | ||
14 | struct SubmitEventInit : public DOM::EventInit { | |
15 | JS::GCPtr<HTMLElement> submitter; | |
16 | }; | |
17 | ||
18 | class SubmitEvent final : public DOM::Event { | |
19 | WEB_PLATFORM_OBJECT(SubmitEvent, DOM::Event); | |
20 | JS_DECLARE_ALLOCATOR(SubmitEvent); | |
21 | ||
22 | public: | |
23 | [[nodiscard]] static JS::NonnullGCPtr<SubmitEvent> create(JS::Realm&, FlyString const& event_name, SubmitEventInit const& event_init); | |
24 | static WebIDL::ExceptionOr<JS::NonnullGCPtr<SubmitEvent>> construct_impl(JS::Realm&, FlyString const& event_name, SubmitEventInit const& event_init); | |
25 | ||
26 | virtual ~SubmitEvent() override; | |
27 | ||
28 | 0 | JS::GCPtr<HTMLElement> submitter() const { return m_submitter; } |
29 | ||
30 | private: | |
31 | SubmitEvent(JS::Realm&, FlyString const& event_name, SubmitEventInit const& event_init); | |
32 | ||
33 | virtual void initialize(JS::Realm&) override; | |
34 | virtual void visit_edges(Cell::Visitor&) override; | |
35 | ||
36 | JS::GCPtr<HTMLElement> m_submitter; | |
37 | }; | |
38 | ||
39 | } |