MacViews: MenuCommandPriority test fails |
||||||||
Issue description
The browser test GlobalKeyboardShortcutsTest.MenuCommandPriority fails when ViewsBrowserMode is enabled.
This test is checking that user key equivalents (added via System Preferences > Keyboard > Shortcuts) can replace browser hotkeys. It fails in ViewsBrowserMode because this logic in [ChromeCommandDispatcherDelegate prePerformKeyEquivalent:window:] behaves incorrectly in Views mode:
// If a command has a menu key equivalent that *replaces* one of the window
// keyboard shortcuts, the menu key equivalent needs to be executed, because
// these are user-addded keyboard shortcuts that replace builtin shortcuts.
//
// If a command has a menu key equivalent that does *not* replace a window
// keyboard shortcut, it will be handled later; only window shortcuts need
// special handling here since they happen before normal command dispatch.
int cmd = MenuCommandForKeyEvent(event);
if (cmd != -1) {
int keyCmd = CommandForExtraKeyboardShortcut(
event, window, CommandForWindowKeyboardShortcut);
Browser* browser = chrome::FindBrowserWithWindow(window);
if (keyCmd != -1 && browser) {
chrome::ExecuteCommand(browser, cmd);
return YES;
}
}
In the Views browser, hotkeys still go through this code path, but the command table used for CommandForWindowKeyboardShortcut() is far less extensive, because most of the browser hotkeys are actually in accelerator_table.cc's kAcceleratorMap. This prevents this logic from detecting when a user shortcut aliases a browser hotkey. The simplest fix is to have CommandForWindowKeyboardShortcut also consult kAcceleratorMap, but I think this will run afoul of the Cocoa-side GetDelayedWindowKeyboardShortcutTable logic - the Cocoa browser has multiple "phases" of hotkeys, which are not reflected in kAcceleratorMap. There's another issue with that approach too: kAcceleratorMap duplicates many hotkeys that appear in menu key equivalents, so wiring up kAcceleratorMap here causes the "user hotkey override" code path to trigger for nearly all hotkeys, which is clearly not right. Perhaps the answer is to have a Mac-specific version of kAcceleratorMap with most of the bindings hacked out?
Over to erikchen@, who is working on other hotkey stuff.
,
May 22 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/f5657a5f0a439076a29a8d17fddfc4175792dfcf commit f5657a5f0a439076a29a8d17fddfc4175792dfcf Author: Elly Fong-Jones <ellyjones@chromium.org> Date: Tue May 22 16:04:41 2018 macviews: disable MenuCommandPriority test Bug: 845503 Change-Id: I39d3ea680d530fcb4dfd2321f28a10eb21141cf2 Reviewed-on: https://chromium-review.googlesource.com/1068997 Reviewed-by: Robert Sesek <rsesek@chromium.org> Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org> Cr-Commit-Position: refs/heads/master@{#560620} [modify] https://crrev.com/f5657a5f0a439076a29a8d17fddfc4175792dfcf/chrome/browser/global_keyboard_shortcuts_mac_browsertest.mm
,
May 24 2018
I think the same issue also affects CommandsApiTest.OverwriteBookmarkShortcutByUserOverridesWebKeybinding.
,
May 24 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/5efe3d409d0600b8c234ffb764f2e5b98267f54b commit 5efe3d409d0600b8c234ffb764f2e5b98267f54b Author: Elly Fong-Jones <ellyjones@chromium.org> Date: Thu May 24 17:26:02 2018 macviews: disable one CommandsApiTest test This test is broken because of the issues with MacViews keyboard event dispatch, as tracked in the linked bug. TBR=rockot@chromium.org Bug: 845503 Change-Id: Ia5aba0918fb16cb5d2271bcbbd7bcc8bab1b015b Reviewed-on: https://chromium-review.googlesource.com/1071693 Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org> Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org> Cr-Commit-Position: refs/heads/master@{#561539} [modify] https://crrev.com/5efe3d409d0600b8c234ffb764f2e5b98267f54b/chrome/browser/extensions/extension_keybinding_apitest.cc
,
Jun 22 2018
,
Jun 26 2018
Test has been reenabled and fixed
,
Sep 27
No, the test is still disabled: https://cs.chromium.org/chromium/src/chrome/browser/extensions/extension_keybinding_apitest.cc?rcl=50db3d6ab7f88f43fcf010513859959ddf291555&l=582
,
Oct 11
back to triage
,
Oct 11
I remember now. There were two disabled tests. The first MenuCommandPriority was fixed and reenabled. The second test is OverwriteBookmarkShortcutByUserOverridesWebKeybinding, which is only used by unmaintained extensions. I started the process of removing the unmaintained extensions a few months ago. The extensions were deprecated and self-uninstall as of Aug 15. This means that the code can now be removed: https://chromium-review.googlesource.com/c/chromium/src/+/1133335
,
Oct 11
#9: Oops, you and I raced and I made <https://chromium-review.googlesource.com/c/chromium/src/+/1276786> :)
,
Oct 11
,
Oct 11
,
Oct 11
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/2d75f41c49ca553e28ade9c5a191e3167e8add36 commit 2d75f41c49ca553e28ade9c5a191e3167e8add36 Author: Elly Fong-Jones <ellyjones@chromium.org> Date: Thu Oct 11 15:30:46 2018 macviews: re-enable CommandsApiTest test for keyboard shortcut overrides This test was broken a while ago but now works. Bug: 845503 Change-Id: I5275fe0166d3b82b26f616d0dcfe92e15d457b93 Reviewed-on: https://chromium-review.googlesource.com/c/1276786 Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org> Commit-Queue: Nico Weber <thakis@chromium.org> Reviewed-by: Nico Weber <thakis@chromium.org> Cr-Commit-Position: refs/heads/master@{#598771} [modify] https://crrev.com/2d75f41c49ca553e28ade9c5a191e3167e8add36/chrome/browser/extensions/extension_keybinding_apitest.cc |
||||||||
►
Sign in to add a comment |
||||||||
Comment 1 by rsesek@chromium.org
, May 22 2018