Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2453)

Unified Diff: ash/wm/workspace/workspace_layout_manager.cc

Issue 468923002: Restore window size after accessbility keyboard hides. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ash/wm/workspace/workspace_layout_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/workspace/workspace_layout_manager.cc
diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc
index 71f4b969f7f61c6e531651528bdfb3c45a6512e4..c55c711ff691582d806384eea6d9230a38dc6e29 100644
--- a/ash/wm/workspace/workspace_layout_manager.cc
+++ b/ash/wm/workspace/workspace_layout_manager.cc
@@ -143,15 +143,25 @@ void WorkspaceLayoutManager::OnKeyboardBoundsChanging(
aura::Window *window = text_input_client->GetAttachedWindow();
if (!window || !window_->Contains(window))
return;
- gfx::Rect window_bounds = ScreenUtil::ConvertRectToScreen(
- window_,
- window->GetTargetBounds());
- gfx::Rect intersect = gfx::IntersectRects(window_bounds, new_bounds);
- int shift = std::min(intersect.height(),
- window->bounds().y() - work_area_in_parent_.y());
- if (shift > 0) {
- gfx::Point origin(window->bounds().x(), window->bounds().y() - shift);
- SetChildBounds(window, gfx::Rect(origin, window->bounds().size()));
+ aura::Window *toplevel_window = window->GetToplevelWindow();
+ wm::WindowState* toplevel_window_state = wm::GetWindowState(toplevel_window);
+ if (new_bounds.height() > 0) {
flackr 2014/08/14 18:20:55 nit: Use !new_bounds.IsEmpty() Can't this get call
Peter Wen 2014/08/14 19:13:31 Done. Added HasRestoreBounds guard. @kevers - Is
+ // Store existing bounds to be restored before resizing for keyboard.
+ toplevel_window_state->SaveCurrentBoundsForRestore();
+
+ gfx::Rect window_bounds = ScreenUtil::ConvertRectToScreen(
+ window_,
+ window->GetTargetBounds());
+ gfx::Rect intersect = gfx::IntersectRects(window_bounds, new_bounds);
+ int shift = std::min(intersect.height(),
+ window->bounds().y() - work_area_in_parent_.y());
+ if (shift > 0) {
+ gfx::Point origin(window->bounds().x(), window->bounds().y() - shift);
+ SetChildBounds(window, gfx::Rect(origin, window->bounds().size()));
+ }
+ } else if (toplevel_window_state->HasRestoreBounds()) {
+ // Keyboard hidden, restore original bounds if they exist.
+ toplevel_window_state->SetAndClearRestoreBounds();
}
}
« no previous file with comments | « no previous file | ash/wm/workspace/workspace_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698