| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "ui/keyboard/keyboard_layout_manager.h" | 5 #include "ui/keyboard/keyboard_layout_manager.h" |
| 6 | 6 |
| 7 #include "ui/compositor/layer_animator.h" | 7 #include "ui/compositor/layer_animator.h" |
| 8 #include "ui/keyboard/keyboard_controller.h" | 8 #include "ui/keyboard/keyboard_controller.h" |
| 9 #include "ui/keyboard/keyboard_controller_proxy.h" | 9 #include "ui/keyboard/keyboard_controller_proxy.h" |
| 10 #include "ui/keyboard/keyboard_util.h" | 10 #include "ui/keyboard/keyboard_util.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // Request to change the bounds of child window (AKA the virtual keyboard | 42 // Request to change the bounds of child window (AKA the virtual keyboard |
| 43 // window) should change the container window first. Then the child window is | 43 // window) should change the container window first. Then the child window is |
| 44 // resized and covers the container window. Note the child's bound is only set | 44 // resized and covers the container window. Note the child's bound is only set |
| 45 // in OnWindowResized. | 45 // in OnWindowResized. |
| 46 gfx::Rect old_bounds = controller_->GetContainerWindow()->bounds(); | 46 gfx::Rect old_bounds = controller_->GetContainerWindow()->bounds(); |
| 47 gfx::Rect new_bounds = requested_bounds; | 47 gfx::Rect new_bounds = requested_bounds; |
| 48 if (controller_->keyboard_mode() == FULL_WIDTH) { | 48 if (controller_->keyboard_mode() == FULL_WIDTH) { |
| 49 const gfx::Rect& window_bounds = | 49 const gfx::Rect& window_bounds = |
| 50 controller_->GetContainerWindow()->GetRootWindow()->bounds(); | 50 controller_->GetContainerWindow()->GetRootWindow()->bounds(); |
| 51 new_bounds.set_y(window_bounds.height() - new_bounds.height()); | 51 new_bounds.set_y(window_bounds.height() - new_bounds.height()); |
| 52 // If shelf is positioned on the left side of screen, x is not 0. In |
| 53 // FULL_WIDTH mode, the virtual keyboard should always align with the left |
| 54 // edge of the screen. So manually set x to 0 here. |
| 55 new_bounds.set_x(0); |
| 52 new_bounds.set_width(window_bounds.width()); | 56 new_bounds.set_width(window_bounds.width()); |
| 53 } | 57 } |
| 54 // Keyboard bounds should only be reset when it actually changes. Otherwise | 58 // Keyboard bounds should only be reset when it actually changes. Otherwise |
| 55 // it interrupts the initial animation of showing the keyboard. Described in | 59 // it interrupts the initial animation of showing the keyboard. Described in |
| 56 // crbug.com/356753. | 60 // crbug.com/356753. |
| 57 if (new_bounds == old_bounds) { | 61 if (new_bounds == old_bounds) { |
| 58 return; | 62 return; |
| 59 } | 63 } |
| 60 | 64 |
| 61 ui::LayerAnimator* animator = | 65 ui::LayerAnimator* animator = |
| (...skipping 17 matching lines...) Expand all Loading... |
| 79 // keyboard window is resized even if keyboard is hidden. | 83 // keyboard window is resized even if keyboard is hidden. |
| 80 if (controller_->keyboard_visible()) | 84 if (controller_->keyboard_visible()) |
| 81 controller_->NotifyKeyboardBoundsChanging(requested_bounds); | 85 controller_->NotifyKeyboardBoundsChanging(requested_bounds); |
| 82 } | 86 } |
| 83 } else if (controller_->keyboard_mode() == FLOATING) { | 87 } else if (controller_->keyboard_mode() == FLOATING) { |
| 84 controller_->NotifyKeyboardBoundsChanging(gfx::Rect()); | 88 controller_->NotifyKeyboardBoundsChanging(gfx::Rect()); |
| 85 } | 89 } |
| 86 } | 90 } |
| 87 | 91 |
| 88 } // namespace keyboard | 92 } // namespace keyboard |
| OLD | NEW |