fix: handle shortcuts by default if no WebPreferences object exists (#14766)
DevTools webcontents do not have webpreferences Fixes #14685
This commit is contained in:
parent
0d2a0c7583
commit
6be69048e6
6 changed files with 581 additions and 43 deletions
|
@ -24,12 +24,15 @@ void CommonWebContentsDelegate::HandleKeyboardEvent(
|
|||
if (event.windows_key_code == ui::VKEY_ESCAPE && is_html_fullscreen())
|
||||
ExitFullscreenModeForTab(source);
|
||||
|
||||
// Check if the webContents has preferences and to ignore shortcuts
|
||||
auto* web_preferences = WebContentsPreferences::From(source);
|
||||
if (web_preferences &&
|
||||
web_preferences->IsEnabled("ignoreMenuShortcuts", false))
|
||||
return;
|
||||
|
||||
// Let the NativeWindow handle other parts.
|
||||
if (auto* web_preferences = WebContentsPreferences::From(source)) {
|
||||
if (owner_window() &&
|
||||
!web_preferences->IsEnabled("ignoreMenuShortcuts", false)) {
|
||||
owner_window()->HandleKeyboardEvent(source, event);
|
||||
}
|
||||
if (owner_window()) {
|
||||
owner_window()->HandleKeyboardEvent(source, event);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue