Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: correctly display zoom in accelerator on mac (#15502)
* fix: correctly display zoom in accelerator on mac * add release to patch info
- Loading branch information
1 parent
e9ba26f
commit 833269f
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
From 0000000000000000000000000000000000000000 Web Oct 31 00:00:00 2001 | ||
From: Shelley Vohr <shelley.vohr@gmail.com> | ||
Date: Web, 31 Oct 2018 09:08:02 -0700 | ||
Subject: fix_zoom_display.patch | ||
|
||
This patch was released in 70.0.3512.0. | ||
|
||
diff --git a/ui/base/accelerators/platform_accelerator_cocoa.mm b/ui/base/accelerators/platform_accelerator_cocoa.mm | ||
index 9786168be893..3c177060453a 100644 | ||
--- a/ui/base/accelerators/platform_accelerator_cocoa.mm | ||
+++ b/ui/base/accelerators/platform_accelerator_cocoa.mm | ||
@@ -25,9 +25,16 @@ void GetKeyEquivalentAndModifierMaskFromAccelerator( | ||
if (accelerator.IsCmdDown()) | ||
cocoa_modifiers |= NSEventModifierFlagCommand; | ||
unichar shifted_character; | ||
+ unichar character; | ||
int result = ui::MacKeyCodeForWindowsKeyCode( | ||
- accelerator.key_code(), cocoa_modifiers, &shifted_character, nullptr); | ||
- DCHECK(result != -1); | ||
+ accelerator.key_code(), cocoa_modifiers, &shifted_character, &character); | ||
+ DCHECK_NE(result, -1); | ||
+ | ||
+ // If the key equivalent is itself shifted, then drop Shift from the modifier | ||
+ // flags, otherwise Shift will be required. E.g., curly braces and plus are | ||
+ // both inherently shifted, so the key equivalents shouldn't require Shift. | ||
+ if (shifted_character != character) | ||
+ cocoa_modifiers &= ~NSEventModifierFlagShift; | ||
*key_equivalent = [NSString stringWithFormat:@"%C", shifted_character]; | ||
*modifier_mask = cocoa_modifiers; | ||
} |