| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 /** | 5 /** |
| 6 * @fileoverview A simple, English virtual keyboard implementation. | 6 * @fileoverview A simple, English virtual keyboard implementation. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 var KEY_MODE = 'key'; | 9 var KEY_MODE = 'key'; |
| 10 var SHIFT_MODE = 'shift'; | 10 var SHIFT_MODE = 'shift'; |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 * @type {Array.<Row>} | 571 * @type {Array.<Row>} |
| 572 */ | 572 */ |
| 573 var allRows = []; // Populated during start() | 573 var allRows = []; // Populated during start() |
| 574 | 574 |
| 575 /** | 575 /** |
| 576 * Calculate the height of the row based on the size of the page. | 576 * Calculate the height of the row based on the size of the page. |
| 577 * @return {number} The height of each row, in pixels. | 577 * @return {number} The height of each row, in pixels. |
| 578 */ | 578 */ |
| 579 function getRowHeight() { | 579 function getRowHeight() { |
| 580 var x = window.innerWidth; | 580 var x = window.innerWidth; |
| 581 var y = window.innerHeight - IME_HEIGHT - 2; | 581 var y = window.innerHeight - (imeEnabled ? IME_HEIGHT - 2 : 0); |
| 582 return (x > kKeyboardAspect * y) ? | 582 return (x > kKeyboardAspect * y) ? |
| 583 (height = Math.floor(y / 4)) : | 583 (height = Math.floor(y / 4)) : |
| 584 (height = Math.floor(x / (kKeyboardAspect * 4))); | 584 (height = Math.floor(x / (kKeyboardAspect * 4))); |
| 585 } | 585 } |
| 586 | 586 |
| 587 /** | 587 /** |
| 588 * Set the keyboard mode. | 588 * Set the keyboard mode. |
| 589 * @param {string} mode The new mode. | 589 * @param {string} mode The new mode. |
| 590 * @return {void} | 590 * @return {void} |
| 591 */ | 591 */ |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 | 682 |
| 683 for (var i = 0; i < allRows.length; ++i) { | 683 for (var i = 0; i < allRows.length; ++i) { |
| 684 body.appendChild(allRows[i].makeDOM(getRowHeight())); | 684 body.appendChild(allRows[i].makeDOM(getRowHeight())); |
| 685 allRows[i].showMode(KEY_MODE); | 685 allRows[i].showMode(KEY_MODE); |
| 686 } | 686 } |
| 687 | 687 |
| 688 window.onresize(); | 688 window.onresize(); |
| 689 } | 689 } |
| 690 // TODO(bryeung): would be nice to leave less gutter (without causing | 690 // TODO(bryeung): would be nice to leave less gutter (without causing |
| 691 // rendering issues with floated divs wrapping at some sizes). | 691 // rendering issues with floated divs wrapping at some sizes). |
| OLD | NEW |