diff options
author | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-01 21:53:18 +0000 |
---|---|---|
committer | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-01 21:53:18 +0000 |
commit | a669b3f890adb627c8c9f573a391a9956f039fa1 (patch) | |
tree | 7ee46b5eed03e7235250f9683e8ce7a3d7a8b805 /chrome/browser | |
parent | 20506ed062b506c219f6c6d24a7a0ac256c20cad (diff) | |
download | chromium_src-a669b3f890adb627c8c9f573a391a9956f039fa1.zip chromium_src-a669b3f890adb627c8c9f573a391a9956f039fa1.tar.gz chromium_src-a669b3f890adb627c8c9f573a391a9956f039fa1.tar.bz2 |
keyboard widget: Always position at the bottom of the screen.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/7827001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99250 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/ui/touch/keyboard/keyboard_manager.cc | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/chrome/browser/ui/touch/keyboard/keyboard_manager.cc b/chrome/browser/ui/touch/keyboard/keyboard_manager.cc index d707c22..31179f6 100644 --- a/chrome/browser/ui/touch/keyboard/keyboard_manager.cc +++ b/chrome/browser/ui/touch/keyboard/keyboard_manager.cc @@ -25,6 +25,7 @@ #include "ui/base/animation/slide_animation.h" #include "ui/base/ime/text_input_type.h" #include "ui/gfx/interpolated_transform.h" +#include "ui/gfx/screen.h" #include "views/ime/text_input_type_tracker.h" #include "views/widget/widget.h" @@ -139,9 +140,16 @@ KeyboardWidget::KeyboardWidget() target_(NULL), keyboard_height_(kDefaultKeyboardHeight) { + // The default position of the keyboard widget should be at the bottom, + // spanning the entire width of the screen. + gfx::Rect area = gfx::Screen::GetMonitorAreaNearestPoint(gfx::Point()); + // Initialize the widget first. views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); params.transparent = true; + params.bounds = gfx::Rect(area.x(), + area.y() + area.height() - keyboard_height_, + area.width(), keyboard_height_); Init(params); // Setup the DOM view to host the keyboard. @@ -198,11 +206,6 @@ KeyboardWidget::~KeyboardWidget() { void KeyboardWidget::ShowKeyboardForWidget(views::Widget* widget) { SetTarget(widget); - gfx::Rect rect = target_->GetWindowScreenBounds(); - rect.set_y(rect.y() + rect.height() - keyboard_height_); - rect.set_height(keyboard_height_); - SetBounds(rect); - transform_.reset(new ui::InterpolatedTranslation( gfx::Point(0, keyboard_height_), gfx::Point())); @@ -374,10 +377,12 @@ void KeyboardWidget::Observe(int type, if (height != keyboard_height_) { DCHECK_GE(height, 0) << "Keyboard height should not be negative."; + int old_height = keyboard_height_; keyboard_height_ = height; - gfx::Size size = GetWindowScreenBounds().size(); - size.set_height(keyboard_height_); - SetSize(size); + gfx::Rect rect = GetWindowScreenBounds(); + rect.set_y(rect.y() + old_height - keyboard_height_); + rect.set_height(keyboard_height_); + SetBounds(rect); // TODO(sad): Notify the target widget that the size has changed so it // can update its display accordingly if it wanted to. |