fix: crash when generating shortcut text for super accelerator (#44346)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
parent
f003c1ea6a
commit
633cec167e
4 changed files with 66 additions and 1 deletions
|
@ -132,4 +132,5 @@ build_expose_webplugininfo_interface_to_electron.patch
|
||||||
osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch
|
osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch
|
||||||
feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch
|
feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch
|
||||||
chore_partial_revert_of.patch
|
chore_partial_revert_of.patch
|
||||||
|
ui_add_missing_shortcut_text_for_vkey_command_on_linux.patch
|
||||||
fix_software_compositing_infinite_loop.patch
|
fix_software_compositing_infinite_loop.patch
|
||||||
|
|
|
@ -46,7 +46,7 @@ index 246010af5d09afcdd46188c70f74e24fc093a4b6..7b154ad07b3740e6e5f48bc8b5eafec0
|
||||||
# than here in :chrome_dll.
|
# than here in :chrome_dll.
|
||||||
deps += [ "//chrome:packed_resources_integrity_header" ]
|
deps += [ "//chrome:packed_resources_integrity_header" ]
|
||||||
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
|
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
|
||||||
index f577f0e77c26b246718ad3c792332472ecd04792..93fb0b75912ae1bd862a2f3afb07014d157e0ec2 100644
|
index 29029bfcb44f6f6b34ea37b80a611000c3bf3d28..c3c472d62a9d9c3b4b3edd43f6f270fe8b0720b8 100644
|
||||||
--- a/chrome/test/BUILD.gn
|
--- a/chrome/test/BUILD.gn
|
||||||
+++ b/chrome/test/BUILD.gn
|
+++ b/chrome/test/BUILD.gn
|
||||||
@@ -6753,9 +6753,12 @@ test("unit_tests") {
|
@@ -6753,9 +6753,12 @@ test("unit_tests") {
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: deepak1556 <hop2deep@gmail.com>
|
||||||
|
Date: Tue, 22 Oct 2024 00:27:27 +0900
|
||||||
|
Subject: Add missing shortcut text for VKEY_COMMAND on linux
|
||||||
|
|
||||||
|
Backports https://chromium-review.googlesource.com/c/chromium/src/+/5947724
|
||||||
|
|
||||||
|
diff --git a/ui/base/accelerators/accelerator.cc b/ui/base/accelerators/accelerator.cc
|
||||||
|
index 32a3fc0843656eaa87b85dd63ac1ade6d83b6e5b..ed1ff076b1db6b77d0684bae1931714bf575ebe8 100644
|
||||||
|
--- a/ui/base/accelerators/accelerator.cc
|
||||||
|
+++ b/ui/base/accelerators/accelerator.cc
|
||||||
|
@@ -419,6 +419,8 @@ std::u16string Accelerator::ApplyLongFormModifiers(
|
||||||
|
result = ApplyModifierToAcceleratorString(result, IDS_APP_SEARCH_KEY);
|
||||||
|
#elif BUILDFLAG(IS_WIN)
|
||||||
|
result = ApplyModifierToAcceleratorString(result, IDS_APP_WINDOWS_KEY);
|
||||||
|
+#elif BUILDFLAG(IS_LINUX)
|
||||||
|
+ result = ApplyModifierToAcceleratorString(result, IDS_APP_SUPER_KEY);
|
||||||
|
#else
|
||||||
|
NOTREACHED();
|
||||||
|
#endif
|
||||||
|
diff --git a/ui/base/accelerators/accelerator_unittest.cc b/ui/base/accelerators/accelerator_unittest.cc
|
||||||
|
index 3b29229c02b0dac7197d3e4bf6014733e0f9669a..cfd9396184e16237cbf49c693af0bd80f8a2ee16 100644
|
||||||
|
--- a/ui/base/accelerators/accelerator_unittest.cc
|
||||||
|
+++ b/ui/base/accelerators/accelerator_unittest.cc
|
||||||
|
@@ -58,6 +58,9 @@ TEST(AcceleratorTest, MAYBE_GetShortcutText) {
|
||||||
|
{VKEY_OEM_COMMA, EF_CONTROL_DOWN, u"Ctrl+Comma", u"⌃,"},
|
||||||
|
#if BUILDFLAG(IS_MAC)
|
||||||
|
{VKEY_T, EF_COMMAND_DOWN | EF_CONTROL_DOWN, nullptr, u"⌃⌘T"},
|
||||||
|
+#endif
|
||||||
|
+#if BUILDFLAG(IS_LINUX)
|
||||||
|
+ {VKEY_T, EF_COMMAND_DOWN | EF_CONTROL_DOWN, u"Super+Ctrl+T", nullptr},
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
diff --git a/ui/strings/ui_strings.grd b/ui/strings/ui_strings.grd
|
||||||
|
index bf64f8fbc6d8f6700b40aa0d798dadc67ecc5db6..9307df9b60bcc7bd2a44bb98bc0720901cd8f4a0 100644
|
||||||
|
--- a/ui/strings/ui_strings.grd
|
||||||
|
+++ b/ui/strings/ui_strings.grd
|
||||||
|
@@ -767,6 +767,11 @@ need to be translated for each locale.-->
|
||||||
|
Win
|
||||||
|
</message>
|
||||||
|
</if>
|
||||||
|
+ <if expr="is_linux">
|
||||||
|
+ <message name="IDS_APP_SUPER_KEY" desc="Windows key on Windows keyboards, and Command key on Mac keyboards.">
|
||||||
|
+ Super
|
||||||
|
+ </message>
|
||||||
|
+ </if>
|
||||||
|
<if expr="chromeos_ash">
|
||||||
|
<message name="IDS_APP_META_KEY" desc="External Meta key (Search key on ChromeOS keyboards, Windows key on Windows keyboards, and Command key on Mac keyboards)">
|
||||||
|
Meta
|
|
@ -926,6 +926,20 @@ describe('Menu module', function () {
|
||||||
});
|
});
|
||||||
w.show();
|
w.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('does not crash when rendering menu item with Super or meta accelerator', async () => {
|
||||||
|
const menu = Menu.buildFromTemplate([{
|
||||||
|
label: 'Test Super',
|
||||||
|
accelerator: 'Super+Ctrl+T'
|
||||||
|
}, {
|
||||||
|
label: 'Test Meta',
|
||||||
|
accelerator: 'Meta+Ctrl+T'
|
||||||
|
}]);
|
||||||
|
const menuWillClose = once(menu, 'menu-will-close');
|
||||||
|
menu.popup({ window: w });
|
||||||
|
menu.closePopup();
|
||||||
|
await menuWillClose;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Menu.setApplicationMenu', () => {
|
describe('Menu.setApplicationMenu', () => {
|
||||||
|
|
Loading…
Reference in a new issue