diff options
author | bryeung@chromium.org <bryeung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-29 20:52:48 +0000 |
---|---|---|
committer | bryeung@chromium.org <bryeung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-29 20:52:48 +0000 |
commit | 5416f28fdc1761075f31678b4893b14b8c426dd7 (patch) | |
tree | badf29574f11eb6eb80fa23e8b2be96e05740d5f /ash/shelf | |
parent | e9b8ca8230f9f5f0238289952a8ff54efac7edd9 (diff) | |
download | chromium_src-5416f28fdc1761075f31678b4893b14b8c426dd7.zip chromium_src-5416f28fdc1761075f31678b4893b14b8c426dd7.tar.gz chromium_src-5416f28fdc1761075f31678b4893b14b8c426dd7.tar.bz2 |
Partial fix for keyboard occlusion.
This fixes three aspects of keyboard occlusion. When the keyboard is
showing:
- full-screen windows are resized to still be 100% visible
- panels are moved above the keyboard
- the shelf is hidden
This CL does not address:
- moving focused text fields into view in web pages
BUG=235157
Review URL: https://chromiumcodereview.appspot.com/14477010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@197129 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/shelf')
-rw-r--r-- | ash/shelf/shelf_layout_manager.cc | 26 | ||||
-rw-r--r-- | ash/shelf/shelf_layout_manager.h | 16 |
2 files changed, 39 insertions, 3 deletions
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc index aa3ab2f..977655f 100644 --- a/ash/shelf/shelf_layout_manager.cc +++ b/ash/shelf/shelf_layout_manager.cc @@ -640,7 +640,7 @@ void ShelfLayoutManager::AdjustBoundsBasedOnAlignment(int inset, void ShelfLayoutManager::CalculateTargetBounds( const State& state, TargetBounds* target_bounds) { - const gfx::Rect& available_bounds(root_window_->bounds()); + const gfx::Rect available_bounds(GetAvailableBounds()); gfx::Rect status_size( shelf_->status_area_widget()->GetWindowBoundsInScreen().size()); int shelf_width = 0, shelf_height = 0; @@ -659,7 +659,8 @@ void ShelfLayoutManager::CalculateTargetBounds( shelf_height = kAutoHideSize; else shelf_width = kAutoHideSize; - } else if (state.visibility_state == SHELF_HIDDEN) { + } else if (state.visibility_state == SHELF_HIDDEN || + !keyboard_bounds_.IsEmpty()) { if (IsHorizontalAlignment()) shelf_height = 0; else @@ -697,6 +698,15 @@ void ShelfLayoutManager::CalculateTargetBounds( gfx::Insets(0, 0, 0, GetWorkAreaSize(state, shelf_width)), gfx::Insets(GetWorkAreaSize(state, shelf_height), 0, 0, 0)); + // Also push in the work area inset for the keyboard if it is visible. + if (!keyboard_bounds_.IsEmpty()) { + target_bounds->work_area_insets.Set( + target_bounds->work_area_insets.top(), + target_bounds->work_area_insets.left(), + target_bounds->work_area_insets.bottom() + keyboard_bounds_.height(), + target_bounds->work_area_insets.right()); + } + target_bounds->opacity = (gesture_drag_status_ != GESTURE_DRAG_NONE || state.visibility_state == SHELF_VISIBLE || @@ -913,5 +923,17 @@ int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const { return 0; } +gfx::Rect ShelfLayoutManager::GetAvailableBounds() const { + gfx::Rect bounds(root_window_->bounds()); + bounds.set_height(bounds.height() - keyboard_bounds_.height()); + return bounds; +} + +void ShelfLayoutManager::OnKeyboardBoundsChanging( + const gfx::Rect& keyboard_bounds) { + keyboard_bounds_ = keyboard_bounds; + OnWindowResized(); +} + } // namespace internal } // namespace ash diff --git a/ash/shelf/shelf_layout_manager.h b/ash/shelf/shelf_layout_manager.h index 30ed3e5..2cea12e 100644 --- a/ash/shelf/shelf_layout_manager.h +++ b/ash/shelf/shelf_layout_manager.h @@ -20,6 +20,8 @@ #include "ui/aura/layout_manager.h" #include "ui/gfx/insets.h" #include "ui/gfx/rect.h" +#include "ui/keyboard/keyboard_controller.h" +#include "ui/keyboard/keyboard_controller_observer.h" namespace aura { class RootWindow; @@ -48,7 +50,8 @@ class WorkspaceController; class ASH_EXPORT ShelfLayoutManager : public aura::LayoutManager, public ash::ShellObserver, - public aura::client::ActivationChangeObserver { + public aura::client::ActivationChangeObserver, + public keyboard::KeyboardControllerObserver { public: // TODO(rharrison): Move this observer out of ash::internal:: @@ -279,6 +282,14 @@ class ASH_EXPORT ShelfLayoutManager : int GetWorkAreaSize(const State& state, int size) const; + // Return the bounds available in the parent, taking into account the bounds + // of the keyboard if necessary. + gfx::Rect GetAvailableBounds() const; + + // Overridden from keyboard::KeyboardControllerObserver: + virtual void OnKeyboardBoundsChanging( + const gfx::Rect& keyboard_bounds) OVERRIDE; + // The RootWindow is cached so that we don't invoke Shell::GetInstance() from // our destructor. We avoid that as at the time we're deleted Shell is being // deleted too. @@ -332,6 +343,9 @@ class ASH_EXPORT ShelfLayoutManager : // Used to delay updating shelf background. UpdateShelfObserver* update_shelf_observer_; + // The bounds of the keyboard. + gfx::Rect keyboard_bounds_; + DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager); }; |