Ladybird: Propagate "empty" key events to the WebContent process

We currently drop events which do not have text associated with them.
This prevents e.g. arrow keys from being able to be handled by web
elements. We now match Browser's behavior on Serenity, where these key
events are already propagated.
This commit is contained in:
Timothy Flynn 2023-07-02 22:18:47 -07:00 committed by Andreas Kling
parent 27ca90646d
commit b57199ccb9
Notes: sideshowbarker 2024-07-17 06:39:26 +09:00

View file

@ -369,10 +369,7 @@ void WebContentView::keyPressEvent(QKeyEvent* event)
} }
auto text = event->text(); auto text = event->text();
if (text.isEmpty()) { auto point = text.isEmpty() ? 0u : event->text()[0].unicode();
return;
}
auto point = event->text()[0].unicode();
auto keycode = get_keycode_from_qt_keyboard_event(*event); auto keycode = get_keycode_from_qt_keyboard_event(*event);
auto modifiers = get_modifiers_from_qt_keyboard_event(*event); auto modifiers = get_modifiers_from_qt_keyboard_event(*event);
client().async_key_down(keycode, modifiers, point); client().async_key_down(keycode, modifiers, point);
@ -381,10 +378,7 @@ void WebContentView::keyPressEvent(QKeyEvent* event)
void WebContentView::keyReleaseEvent(QKeyEvent* event) void WebContentView::keyReleaseEvent(QKeyEvent* event)
{ {
auto text = event->text(); auto text = event->text();
if (text.isEmpty()) { auto point = text.isEmpty() ? 0u : event->text()[0].unicode();
return;
}
auto point = event->text()[0].unicode();
auto keycode = get_keycode_from_qt_keyboard_event(*event); auto keycode = get_keycode_from_qt_keyboard_event(*event);
auto modifiers = get_modifiers_from_qt_keyboard_event(*event); auto modifiers = get_modifiers_from_qt_keyboard_event(*event);
client().async_key_up(keycode, modifiers, point); client().async_key_up(keycode, modifiers, point);