Skip to content

Commit

Permalink
Currently when the virtual keyboard shows, we shrink panels that woul…
Browse files Browse the repository at this point in the history
…d be pushed above the screen. This CL restores the window bounds for these panels when the keyboard hides.

BUG=389149

Review URL: https://codereview.chromium.org/356043003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@280361 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
rsadam@chromium.org committed Jun 27, 2014
1 parent 559e1c1 commit f0a99cd
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions ash/wm/panels/panel_layout_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -910,17 +910,27 @@ void PanelLayoutManager::OnKeyboardBoundsChanging(
iter != panel_windows_.end();
++iter) {
aura::Window* panel = iter->window;
gfx::Rect panel_bounds = ScreenUtil::ConvertRectToScreen(
panel->parent(), panel->GetTargetBounds());
int delta = panel_bounds.height() - available_space;
// Ensure panels are not pushed above the parent boundaries, shrink any
// panels that violate this constraint.
if (delta > 0) {
SetChildBounds(panel,
gfx::Rect(panel_bounds.x(),
panel_bounds.y() + delta,
panel_bounds.width(),
panel_bounds.height() - delta));
wm::WindowState* panel_state = wm::GetWindowState(panel);
if (keyboard_bounds.height() > 0) {
// Save existing bounds, so that we can restore them when the keyboard
// hides.
panel_state->SaveCurrentBoundsForRestore();

gfx::Rect panel_bounds = ScreenUtil::ConvertRectToScreen(
panel->parent(), panel->GetTargetBounds());
int delta = panel_bounds.height() - available_space;
// Ensure panels are not pushed above the parent boundaries, shrink any
// panels that violate this constraint.
if (delta > 0) {
SetChildBounds(panel,
gfx::Rect(panel_bounds.x(),
panel_bounds.y() + delta,
panel_bounds.width(),
panel_bounds.height() - delta));
}
} else if (panel_state->HasRestoreBounds()) {
// Keyboard hidden, restore original bounds if they exist.
SetChildBounds(panel, panel_state->GetRestoreBoundsInScreen());
}
}
// This bounds change will have caused a change to the Shelf which does not
Expand Down

0 comments on commit f0a99cd

Please sign in to comment.