/src/serenity/Userland/Libraries/LibWeb/UIEvents/CompositionEvent.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #pragma once |
8 | | |
9 | | #include <LibWeb/UIEvents/UIEvent.h> |
10 | | |
11 | | namespace Web::UIEvents { |
12 | | |
13 | | struct CompositionEventInit : public UIEventInit { |
14 | | String data; |
15 | | }; |
16 | | |
17 | | class CompositionEvent final : public UIEvent { |
18 | | WEB_PLATFORM_OBJECT(CompositionEvent, UIEvent); |
19 | | JS_DECLARE_ALLOCATOR(CompositionEvent); |
20 | | |
21 | | public: |
22 | | [[nodiscard]] static JS::NonnullGCPtr<CompositionEvent> create(JS::Realm&, FlyString const& event_name, CompositionEventInit const& = {}); |
23 | | static WebIDL::ExceptionOr<JS::NonnullGCPtr<CompositionEvent>> construct_impl(JS::Realm&, FlyString const& event_name, CompositionEventInit const& event_init); |
24 | | |
25 | | virtual ~CompositionEvent() override; |
26 | | |
27 | | // https://w3c.github.io/uievents/#dom-compositionevent-data |
28 | 0 | String data() const { return m_data; } |
29 | | |
30 | | void init_composition_event(String const& type, bool bubbles, bool cancelable, HTML::Window* view, String const& data); |
31 | | |
32 | | private: |
33 | | CompositionEvent(JS::Realm&, FlyString const& event_name, CompositionEventInit const&); |
34 | | |
35 | | virtual void initialize(JS::Realm&) override; |
36 | | |
37 | | String m_data; |
38 | | }; |
39 | | |
40 | | } |