mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 18:19:03 +00:00
UI+LibWeb+WebContent: Implement KeyEvent repeat property
When a platform key press or release event is repeated, we now pass along a `repeat` flag to indicate that auto-repeating is happening. This flag eventually ends up in `KeyboardEvent.repeat`.
This commit is contained in:
parent
cf315d54ec
commit
9309cc9df3
Notes:
github-actions[bot]
2024-10-22 15:21:37 +00:00
Author: https://github.com/gmta
Commit: 9309cc9df3
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1913
Reviewed-by: https://github.com/trflynn89 ✅
13 changed files with 39 additions and 35 deletions
|
@ -902,7 +902,7 @@ static ErrorOr<void, WebDriver::Error> dispatch_key_down_action(ActionObject::Ke
|
|||
auto key = normalized_key_value(raw_key);
|
||||
|
||||
// 3. If the source's pressed property contains key, let repeat be true, otherwise let repeat be false.
|
||||
// FIXME: Add `repeat` support to Page::handle_keydown.
|
||||
bool repeat = source.pressed.contains(key);
|
||||
|
||||
// 4. Let code be the code for raw key.
|
||||
auto code = key_code_data(raw_key);
|
||||
|
@ -945,7 +945,7 @@ static ErrorOr<void, WebDriver::Error> dispatch_key_down_action(ActionObject::Ke
|
|||
// keyboard in accordance with the requirements of [UI-EVENTS], and producing the following events, as appropriate,
|
||||
// with the specified properties. This will always produce events including at least a keyDown event.
|
||||
auto event = key_code_to_page_event(raw_key, modifiers, code);
|
||||
browsing_context.page().handle_keydown(code.code, event.modifiers, event.code_point);
|
||||
browsing_context.page().handle_keydown(code.code, event.modifiers, event.code_point, repeat);
|
||||
|
||||
// 13. Return success with data null.
|
||||
return {};
|
||||
|
@ -1005,7 +1005,7 @@ static ErrorOr<void, WebDriver::Error> dispatch_key_up_action(ActionObject::KeyF
|
|||
// keyboard in accordance with the requirements of [UI-EVENTS], and producing at least the following events with
|
||||
// the specified properties:
|
||||
auto event = key_code_to_page_event(raw_key, modifiers, code);
|
||||
browsing_context.page().handle_keyup(code.code, event.modifiers, event.code_point);
|
||||
browsing_context.page().handle_keyup(code.code, event.modifiers, event.code_point, false);
|
||||
|
||||
// 13. Return success with data null.
|
||||
return {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue