mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-23 08:00:20 +00:00
LibWeb: Add "which" attribute to UIEvent
This is non-standard but is supported by all major browsers.
This commit is contained in:
parent
1b94b4c593
commit
7f45a9e9c1
Notes:
sideshowbarker
2024-07-17 14:14:21 +09:00
Author: https://github.com/Igoorx Commit: https://github.com/SerenityOS/serenity/commit/7f45a9e9c1 Pull-request: https://github.com/SerenityOS/serenity/pull/13589
4 changed files with 7 additions and 0 deletions
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue