LibWeb: Add "which" attribute to UIEvent

This is non-standard but is supported by all major browsers.
This commit is contained in:
Igor Pissolati 2022-04-09 12:45:05 -03:00 committed by Andreas Kling
parent 1b94b4c593
commit 7f45a9e9c1
Notes: sideshowbarker 2024-07-17 14:14:21 +09:00
4 changed files with 7 additions and 0 deletions

View file

@ -58,6 +58,8 @@ public:
bool get_modifier_state(String const& key_arg);
virtual u32 which() const override { return m_key_code; }
private:
KeyboardEvent(FlyString const& event_name, KeyboardEventInit const& event_init)
: UIEvent(event_name, event_init)

View file

@ -45,6 +45,8 @@ public:
i16 button() const { return m_button; }
virtual u32 which() const override { return m_button + 1; }
private:
MouseEvent(FlyString const& event_name, MouseEventInit const& event_init);

View file

@ -35,6 +35,7 @@ public:
HTML::Window const* view() const { return m_view; }
int detail() const { return m_detail; }
virtual u32 which() const { return 0; }
void init_ui_event(String const& type, bool bubbles, bool cancelable, HTML::Window* view, int detail)
{

View file

@ -7,6 +7,8 @@ interface UIEvent : Event {
// NOTE: This is "deprecated, but supported for backwards-compatibility with widely-deployed implementations."
[ImplementedAs=init_ui_event] undefined initUIEvent(DOMString typeArg, optional boolean bubblesArg = false, optional boolean cancelableArg = false, optional Window? viewArg = null, optional long detailArg = 0);
readonly attribute unsigned long which;
};
dictionary UIEventInit : EventInit {