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 593e386936dd4167f21ca08105d0024186715185..00b24f49e77cfe138a41b99dcc773d52fcabd666 100644 |
--- a/ui/events/keycodes/platform_key_map_win.cc |
+++ b/ui/events/keycodes/platform_key_map_win.cc |
@@ -209,15 +209,40 @@ DomKey LanguageSpecificOemKeyboardCodeToDomKey(KeyboardCode key_code, |
default: |
return DomKey::NONE; |
} |
+ } else if (primary_language == LANG_JAPANESE) { |
+ switch (key_code) { |
+ case VKEY_KANA: |
+ return DomKey::KANA_MODE; |
chongz
2016/07/06 22:50:34
|VKEY_KANA| is not used with modern Japanese keybo
Wez
2016/07/07 18:25:51
When you say "modern keyboard" do you mean modern
chongz
2016/07/07 22:18:09
Actually FireFox says so but I cannot find more in
Wez
2016/07/08 23:34:06
That's really unfortunate. It sounds like the Fire
|
+ case VKEY_KANJI: |
+ return DomKey::KANJI_MODE; |
+ case VKEY_OEM_ATTN: |
+ return DomKey::ALPHANUMERIC; |
+ case VKEY_OEM_FINISH: |
+ return DomKey::KATAKANA; |
+ case VKEY_OEM_COPY: |
+ return DomKey::HIRAGANA; |
+ case VKEY_DBE_SBCSCHAR: |
+ return DomKey::HANKAKU; |
+ case VKEY_DBE_DBCSCHAR: |
+ return DomKey::ZENKAKU; |
+ case VKEY_OEM_BACKTAB: |
+ return DomKey::ROMAJI; |
+ case VKEY_ATTN: |
+ return DomKey::KANA_MODE; |
chongz
2016/07/06 22:50:34
On other layouts |VKEY_ATTN| will be mapped to |Do
|
+ default: |
+ return DomKey::NONE; |
+ } |
} |
- // TODO(chongz): Handle Japanese keyboard layout keys 0xF0..0xF5, VKEY_KANA, |
- // VKEY_KANJI. |
- // https://crbug.com/612694 |
return DomKey::NONE; |
} |
DomKey NonPrintableKeyboardCodeToDomKey(KeyboardCode key_code, HKL layout) { |
- // 1. Most |key_codes| have the same meaning regardless of |layout|. |
+ // 1. Check if |key_code| has a |layout|-specific meaning. |
+ const DomKey key = LanguageSpecificOemKeyboardCodeToDomKey(key_code, layout); |
+ if (key != DomKey::NONE) |
+ return key; |
chongz
2016/07/06 22:50:34
Do language mapping first so JIS could map |VKEY_A
Wez
2016/07/07 18:25:51
Acknowledged.
|
+ |
+ // 2. Most |key_codes| have the same meaning regardless of |layout|. |
const NonPrintableKeyEntry* result = std::lower_bound( |
std::begin(kNonPrintableKeyMap), std::end(kNonPrintableKeyMap), key_code, |
[](const NonPrintableKeyEntry& entry, KeyboardCode needle) { |
@@ -225,8 +250,8 @@ DomKey NonPrintableKeyboardCodeToDomKey(KeyboardCode key_code, HKL layout) { |
}); |
if (result != std::end(kNonPrintableKeyMap) && result->key_code == key_code) |
return result->dom_key; |
- // 2. Look up a |layout|-specific meaning for |key_code|. |
- return LanguageSpecificOemKeyboardCodeToDomKey(key_code, layout); |
+ |
+ return DomKey::NONE; |
} |
void CleanupKeyMapTls(void* data) { |
@@ -280,11 +305,12 @@ DomKey PlatformKeyMap::DomKeyFromKeyboardCodeImpl(KeyboardCode key_code, |
if (it != printable_keycode_to_key_.end()) { |
key = it->second; |
if (key != DomKey::NONE) |
- break; |
+ return key; |
} |
} |
- return key; |
+ // Return DomKey::UNIDENTIFIED to prevent US layout fall-back. |
+ return DomKey::UNIDENTIFIED; |
chongz
2016/07/06 22:50:34
|KeyEvent::ApplyLayout()| will do the fall-back ma
Wez
2016/07/07 18:25:51
Acknowledged.
|
} |
// static |