UI/AppKit: Do not expose PUA key event code points to WebContent

AppKit uses Private Use Area code points for a large collection of
functional keys (arrows, home/end, etc.). Re-assign them to 0 to avoid
tripping up WebContent's key handler.
This commit is contained in:
Timothy Flynn 2024-09-04 21:13:38 -04:00 committed by Tim Ledbetter
parent 813612096c
commit 6a0c67d5d2
Notes: github-actions[bot] 2024-09-05 13:39:13 +00:00

View file

@ -304,6 +304,10 @@ Web::KeyEvent ns_event_to_key_event(Web::KeyEvent::Type type, NSEvent* event)
// FIXME: WebContent should really support multi-code point key events.
auto code_point = utf8_view.is_empty() ? 0u : *utf8_view.begin();
// NSEvent assigns PUA code points to to functional keys, e.g. arrow keys. Do not propagate them.
if (code_point >= 0xE000 && code_point <= 0xF8FF)
code_point = 0;
return { type, key_code, modifiers, code_point, make<KeyData>(event) };
}