Chromium Code Reviews| Index: ui/events/keycodes/platform_key_map_win.cc |
| diff --git a/ui/events/keycodes/platform_key_map_win.cc b/ui/events/keycodes/platform_key_map_win.cc |
| index 439384c634941d9eb9017b047e3dd464860a9f9f..c5a290c4dd8adf3bad92e0694768a7fb35dd660d 100644 |
| --- a/ui/events/keycodes/platform_key_map_win.cc |
| +++ b/ui/events/keycodes/platform_key_map_win.cc |
| @@ -287,6 +287,9 @@ PlatformKeyMap::~PlatformKeyMap() {} |
| DomKey PlatformKeyMap::DomKeyFromKeyboardCodeImpl(KeyboardCode key_code, |
| int flags) const { |
| DomKey key = NonPrintableKeyboardCodeToDomKey(key_code, keyboard_layout_); |
| + if (key == DomKey::ALT && (flags & EF_IS_EXTENDED_KEY) && has_alt_graph_) { |
|
garykac
2017/01/18 15:55:29
Could you add a brief comment above this line?
Wez
2017/01/18 21:36:35
Done.
|
| + return DomKey::ALT_GRAPH; |
| + } |
| if (key != DomKey::NONE) |
| return key; |
| @@ -346,6 +349,7 @@ void PlatformKeyMap::UpdateLayout(HKL layout) { |
| // TODO(chongz): Optimize layout switching (see crbug.com/587147). |
| keyboard_layout_ = layout; |
| printable_keycode_to_key_.clear(); |
| + has_alt_graph_ = false; |
| // Map size for some sample keyboard layouts: |
| // US: 476, French: 602, Persian: 482, Vietnamese: 1436 |
| @@ -385,6 +389,11 @@ void PlatformKeyMap::UpdateLayout(HKL layout) { |
| printable_keycode_to_key_[std::make_pair(static_cast<int>(key_code), |
| flags)] = |
| DomKey::FromCharacter(translated_chars[0]); |
| + |
| + // Detect whether the layout makes use of AltGraph. |
| + if (flags & EF_ALTGR_DOWN) { |
| + has_alt_graph_ = true; |
| + } |
| } else { |
| // Ignores legacy non-printable control characters. |
| } |