ladybird/Libraries/LibWeb/UIEvents/CompositionEvent.h
Andreas Kling 3e8c8b185e LibWeb: Use WindowProxy instead of Window in UI Events IDL
I believe this is an error in the UI Events spec, and it should be
updated to match the HTML spec (which uses WindowProxy everywhere).

This fixes a bunch of issues already covered by existing WPT tests.

Spec bug: https://github.com/w3c/uievents/issues/388

Note that WebKit has been using WindowProxy instead of Window in
UI Events IDL since 2018:
816158b4aa
2024-11-17 23:47:24 +01:00

40 lines
1.2 KiB
C++

/*
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/UIEvents/UIEvent.h>
namespace Web::UIEvents {
struct CompositionEventInit : public UIEventInit {
String data;
};
class CompositionEvent final : public UIEvent {
WEB_PLATFORM_OBJECT(CompositionEvent, UIEvent);
GC_DECLARE_ALLOCATOR(CompositionEvent);
public:
[[nodiscard]] static GC::Ref<CompositionEvent> create(JS::Realm&, FlyString const& event_name, CompositionEventInit const& = {});
static WebIDL::ExceptionOr<GC::Ref<CompositionEvent>> construct_impl(JS::Realm&, FlyString const& event_name, CompositionEventInit const& event_init);
virtual ~CompositionEvent() override;
// https://w3c.github.io/uievents/#dom-compositionevent-data
String data() const { return m_data; }
void init_composition_event(String const& type, bool bubbles, bool cancelable, GC::Ptr<HTML::WindowProxy> view, String const& data);
private:
CompositionEvent(JS::Realm&, FlyString const& event_name, CompositionEventInit const&);
virtual void initialize(JS::Realm&) override;
String m_data;
};
}