DescriptionMacViews: Intercept events for Menus (after AppKit has turned them into action messages).
Currently keystrokes while a menu is open are sent to the window hosting
the menu, since it remains `key`. Menus are a different window, so this
causes all the Menu* interactive_ui_tests to fail since they simulate
pressing ESC to dismiss the menu in the tests.
Other platforms insert an event dispatcher into the message pump for the
nested run loop that shows a menu, and redirect KeyDown events to the
MenuController.
On Mac, events need to be mapped to "Action" messages by an NSResponder
to obey platform behaviour and user customizations (e.g. a "Home"
keypress should be interpreted as beginning of document, not beginning
of line).
The approach in this CL is to check in BridgedContentView, an
NSResponder, for an active menu that should be receiving events instead.
Action messages are mapped to the KeyCode that toolkit-views expects for
that action, and the MenuController is given an opportunity to swallow
the event or have it sent on to the key window.
Gets the following interactive_ui_tests passing:
MenuControllerMnemonicTest*{NoMatch,TitleMatch,MnemonicMatch}
MenuItemViewTestRemoveWithSubmenu{0,1}*
(and all Menu interactive UI tests pass after this).
BUG=403679
Committed: https://crrev.com/370605a7ffb0392e48729591dc8f6fca79cdc987
Cr-Commit-Position: refs/heads/master@{#314711}
Patch Set 1 #Patch Set 2 : rebase for r313520 #Patch Set 3 : Nicer keycode/character handling. Fixes MenuMnemonic flakes #Patch Set 4 : better IME handling #
Total comments: 1
Messages
Total messages: 11 (5 generated)
|