fix: handle shortcuts by default if no WebPreferences object exists (#15066)
This commit is contained in:
parent
3d8af9d279
commit
502b0b988e
6 changed files with 579 additions and 19 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