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

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: Fix per reviewer. 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..12abfd19611592a4f0bc79cd6d157ceb1e393fca 100644
--- a/ash/wm/workspace/workspace_layout_manager.cc
+++ b/ash/wm/workspace/workspace_layout_manager.cc
@@ -143,15 +143,28 @@ 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.IsEmpty()) {
+ // Store existing bounds to be restored before resizing for keyboard if it
+ // is not already stored.
+ if (!toplevel_window_state->HasRestoreBounds()) {
flackr 2014/08/14 19:17:58 nit: no curlies { } for single line statement. No
Peter Wen 2014/08/15 13:44:48 Done. It seems that workspace_layout_manager's on
+ 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) {
flackr 2014/08/14 19:17:58 Should we even set restore bounds if there is no c
Peter Wen 2014/08/15 13:44:48 Yes, as that way even if the focused input area do
flackr 2014/08/20 15:02:14 Alright, sounds fine. It should be fine either way
+ 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