Index: chrome/browser/resources/keyboard/ime.js |
diff --git a/chrome/browser/resources/keyboard/ime.js b/chrome/browser/resources/keyboard/ime.js |
index 662e6f88d81a14b1310a43235e83c78b5d1eb282..2c94e051b1ed8d28264defb3ad5de41cc78a27c2 100644 |
--- a/chrome/browser/resources/keyboard/ime.js |
+++ b/chrome/browser/resources/keyboard/ime.js |
@@ -9,6 +9,7 @@ |
/** |
* Const variables |
*/ |
+const IME_KEYBOARD_HEIGHT = 300; |
const IME_HEIGHT = 48; |
const IME_VMARGIN = 12; |
const IME_HMARGIN = 16; |
@@ -123,6 +124,15 @@ ImeUi.prototype = { |
} |
this.appendChild(this.pageDown_); |
+ this.update(); |
+ }, |
+ |
+ /** |
+ * Returns true if Ime Ui is visible. |
+ * @return {boolean} |
+ */ |
+ get visible() { |
+ return this.style.display != 'none'; |
}, |
/** |
@@ -171,14 +181,21 @@ ImeUi.prototype = { |
}, |
update : function() { |
- // TODO(penghuang) Add API for show and hide ImeUI. |
- // Currently, ImeUi is always visible. |
- if (true || (this.table_ && this.table_.visible) || this.auxiliary_.text_) { |
- this.style.display = 'block'; |
+ var visible = |
+ (this.table_ && this.table_.visible) || this.auxiliary_.text_; |
+ |
+ if (visible == this.visible) { |
+ return; |
+ } |
+ |
+ if (visible) { |
+ chrome.experimental.input.setKeyboardHeight( |
+ IME_KEYBOARD_HEIGHT + IME_HEIGHT); |
+ this.style.display = 'inline-block'; |
} else { |
this.style.display = 'none'; |
+ chrome.experimental.input.setKeyboardHeight(IME_KEYBOARD_HEIGHT); |
} |
- |
// TODO(penghuang) Adjust the width of all items in ImeUi to fill the width |
// of keyboard. |
}, |