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

Side by Side Diff: ui/keyboard/resources/main.js

Issue 16972006: Insert text directly from the virtual keyboard. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix include Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/keyboard/resources/keysets.html ('k') | ui/keyboard/resources/voice_input.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var onResize = function() { 5 var onResize = function() {
6 var x = window.innerWidth; 6 var x = window.innerWidth;
7 var y = window.innerHeight; 7 var y = window.innerHeight;
8 var height = (x > ASPECT_RATIO * y) ? y : Math.floor(x / ASPECT_RATIO); 8 var height = (x > ASPECT_RATIO * y) ? y : Math.floor(x / ASPECT_RATIO);
9 keyboard.style.height = height + 'px'; 9 keyboard.style.height = height + 'px';
10 keyboard.style.width = Math.floor(ASPECT_RATIO * height) + 'px'; 10 keyboard.style.width = Math.floor(ASPECT_RATIO * height) + 'px';
11 keyboard.style.fontSize = (height / FONT_SIZE_RATIO / ROW_LENGTH) + 'px'; 11 keyboard.style.fontSize = (height / FONT_SIZE_RATIO / ROW_LENGTH) + 'px';
12 }; 12 };
13 13
14 /**
15 * Send the given key to chrome.
16 */
17 function sendKey(key) {
18 var keyIdentifier = key;
19
20 // Fix up some keys to their respective identifiers for convenience.
21 if (keyIdentifier == ' ') {
22 keyIdentifier = 'Spacebar';
23 }
24
25 var keyEvent = {
26 keyIdentifier: keyIdentifier
27 };
28
29 sendKeyEvent(keyEvent);
30 };
31
32 addEventListener('WebComponentsReady', function() { 14 addEventListener('WebComponentsReady', function() {
33 keyboard.appendChild( 15 keyboard.appendChild(
34 keysets.content.body.firstElementChild.createInstance()); 16 keysets.content.body.firstElementChild.createInstance());
35 }); 17 });
36 18
37 addEventListener('resize', onResize); 19 addEventListener('resize', onResize);
38 20
39 addEventListener('load', onResize); 21 addEventListener('load', onResize);
OLDNEW
« no previous file with comments | « ui/keyboard/resources/keysets.html ('k') | ui/keyboard/resources/voice_input.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698