| Index: ui/keyboard/resources/elements/kb-keyboard.html
|
| diff --git a/ui/keyboard/resources/elements/kb-keyboard.html b/ui/keyboard/resources/elements/kb-keyboard.html
|
| index d373ad773364ed0cc7d39f5f4512908537316cd2..611a7254124fbd6d595aa678db4cd86114e0ba1a 100644
|
| --- a/ui/keyboard/resources/elements/kb-keyboard.html
|
| +++ b/ui/keyboard/resources/elements/kb-keyboard.html
|
| @@ -23,6 +23,7 @@
|
| -- keyboard layouts.
|
| -->
|
| <content select="#{{layout}}-{{keyset}}"></content>
|
| + <kb-key-codes id="keyCodeMetadata"></kb-key-codes>
|
| </template>
|
| <script>
|
| /**
|
| @@ -298,12 +299,13 @@
|
| }
|
|
|
| if (detail.repeat) {
|
| - insertText(detail.char);
|
| + this.keyTyped(detail);
|
| repeatKey.key = this.lastPressedKey;
|
| + var self = this;
|
| repeatKey.timer = setTimeout(function() {
|
| repeatKey.timer = undefined;
|
| repeatKey.interval = setInterval(function() {
|
| - insertText(detail.char);
|
| + self.keyTyped(detail);
|
| }, REPEAT_INTERVAL_MSEC);
|
| }, Math.max(0, REPEAT_DELAY_MSEC - REPEAT_INTERVAL_MSEC));
|
| }
|
| @@ -436,7 +438,10 @@
|
| default:
|
| break;
|
| }
|
| - insertText(char);
|
| + if (char.length == 1)
|
| + this.keyTyped(detail);
|
| + else
|
| + insertText(char);
|
| },
|
|
|
| /*
|
| @@ -481,6 +486,17 @@
|
| },
|
|
|
| /**
|
| + * Generates fabricated key events to simulate typing on a
|
| + * physical keyboard.
|
| + * @param {Object} detail Attributes of the key being typed.
|
| + */
|
| + keyTyped: function(detail) {
|
| + var builder = this.$.keyCodeMetadata;
|
| + sendKeyEvent(builder.CreateVirtualKeyEvent(detail, "keydown"));
|
| + sendKeyEvent(builder.CreateVirtualKeyEvent(detail, "keyup"));
|
| + },
|
| +
|
| + /**
|
| * Selects the default keyset for a layout.
|
| * @return {boolean} True if successful. This method can fail if the
|
| * keysets corresponding to the layout have not been injected.
|
|
|