1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:47:45 +00:00

LibWeb: Fire a keypress event after firing a keydown event

In Google Docs with our user agent string, this is the event it listens
for to insert characters into the document.
This commit is contained in:
Luke Wilde 2022-11-05 15:37:19 +00:00 committed by Andreas Kling
parent e4688fedd5
commit 11ede565a8
2 changed files with 7 additions and 1 deletions

View file

@ -771,7 +771,12 @@ bool EventHandler::handle_keydown(KeyCode key, unsigned modifiers, u32 code_poin
return true; return true;
} }
return fire_keyboard_event(UIEvents::EventNames::keydown, m_browsing_context, key, modifiers, code_point); bool continue_ = fire_keyboard_event(UIEvents::EventNames::keydown, m_browsing_context, key, modifiers, code_point);
if (!continue_)
return false;
// FIXME: Work out and implement the difference between this and keydown.
return fire_keyboard_event(UIEvents::EventNames::keypress, m_browsing_context, key, modifiers, code_point);
} }
bool EventHandler::handle_keyup(KeyCode key, unsigned modifiers, u32 code_point) bool EventHandler::handle_keyup(KeyCode key, unsigned modifiers, u32 code_point)

View file

@ -17,6 +17,7 @@ namespace Web::UIEvents::EventNames {
__ENUMERATE_UI_EVENT(click) \ __ENUMERATE_UI_EVENT(click) \
__ENUMERATE_UI_EVENT(dblclick) \ __ENUMERATE_UI_EVENT(dblclick) \
__ENUMERATE_UI_EVENT(keydown) \ __ENUMERATE_UI_EVENT(keydown) \
__ENUMERATE_UI_EVENT(keypress) \
__ENUMERATE_UI_EVENT(keyup) \ __ENUMERATE_UI_EVENT(keyup) \
__ENUMERATE_UI_EVENT(mousedown) \ __ENUMERATE_UI_EVENT(mousedown) \
__ENUMERATE_UI_EVENT(mouseenter) \ __ENUMERATE_UI_EVENT(mouseenter) \