Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Unified Diff: ui/keyboard/resources/elements/kb-key-codes.html

Issue 46043004: Fixes modifier handling for repeat keys. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/keyboard/resources/elements/kb-keyboard.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/keyboard/resources/elements/kb-key-codes.html
diff --git a/ui/keyboard/resources/elements/kb-key-codes.html b/ui/keyboard/resources/elements/kb-key-codes.html
index 4f7bc827ff89256036f9db758a14f3e41b7d848b..d076ec58a559a7f15cd4b247d1be2a0138a08fd2 100644
--- a/ui/keyboard/resources/elements/kb-key-codes.html
+++ b/ui/keyboard/resources/elements/kb-key-codes.html
@@ -29,7 +29,9 @@
// keyCode attribute for kb-key or kb-keysequence elements to refer to
// indices in this table in order to emulate a physical keyboard with an
// alternate layout. Not all keys on a virtual keyboard are required to
- // have keyCodes.
+ // have keyCodes. The shiftModifier specifies whether to always include or
+ // exclude the shift modifer when sending key events for this key. If it's
+ // undefined, it will defer to state of the keyboard.
// TODO(rsadam): Correctly propagate shutdown keycode. This is currently
// ignored due to chromoting (crbug/146609)
var keyCodes = {
@@ -38,10 +40,10 @@
'\n': {keyCode: 0x0D, shiftModifier: false},
'Esc': {keyCode: 0x1B, shiftModifier: false},
' ': {keyCode: 0x20, shiftModifier: false},
- 'Arrow-Left': {keyCode: 0x25, shiftModifier: false},
- 'Arrow-Up': {keyCode: 0x26, shiftModifier: false},
- 'Arrow-Right': {keyCode: 0x27, shiftModifier: false},
- 'Arrow-Down': {keyCode: 0x28, shiftModifier: false},
+ 'Arrow-Left': {keyCode: 0x25, shiftModifier: undefined},
+ 'Arrow-Up': {keyCode: 0x26, shiftModifier: undefined},
+ 'Arrow-Right': {keyCode: 0x27, shiftModifier: undefined},
+ 'Arrow-Down': {keyCode: 0x28, shiftModifier: undefined},
'0': {keyCode: 0x30, shiftModifier: false},
')': {keyCode: 0x30, shiftModifier: true},
'1': {keyCode: 0x31, shiftModifier: false},
@@ -186,13 +188,16 @@
var keyCode = detail.keyCode;
// The shift modifier is handled specially. Some charactares like '+'
// {keyCode: 0xBB, shiftModifier: true}, are available on non-upper
- // keysets, and so we rely on caching the correct shiftModifier.
+ // keysets, and so we rely on caching the correct shiftModifier. If
+ // the cached value of the shiftModifier is undefined, we defer to
+ // the shiftModifier in the detail.
var shiftModifier = detail.shiftModifier;
if (keyCode == undefined) {
var state = this.GetKeyCodeAndModifiers(char);
if (state) {
keyCode = state.keyCode;
- shiftModifier = state.shiftModifier;
+ shiftModifier = (state.shiftModifier == undefined) ?
+ shiftModifier : state.shiftModifier;
} else {
// Keycode not defined.
return;
« no previous file with comments | « no previous file | ui/keyboard/resources/elements/kb-keyboard.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698