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

Side by Side Diff: ash/wm/workspace/workspace_layout_manager.cc

Issue 506133002: Fixes moving fully occluded windows when the a11y keyboard shows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@window-resize
Patch Set: Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | ash/wm/workspace/workspace_layout_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/wm/workspace/workspace_layout_manager.h" 5 #include "ash/wm/workspace/workspace_layout_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/display/display_controller.h" 9 #include "ash/display/display_controller.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 text_input_client->GetAttachedWindow()->GetToplevelWindow(); 143 text_input_client->GetAttachedWindow()->GetToplevelWindow();
144 if (!window || !window_->Contains(window)) 144 if (!window || !window_->Contains(window))
145 return; 145 return;
146 wm::WindowState* window_state = wm::GetWindowState(window); 146 wm::WindowState* window_state = wm::GetWindowState(window);
147 if (!new_bounds.IsEmpty()) { 147 if (!new_bounds.IsEmpty()) {
148 // Store existing bounds to be restored before resizing for keyboard if it 148 // Store existing bounds to be restored before resizing for keyboard if it
149 // is not already stored. 149 // is not already stored.
150 if (!window_state->HasRestoreBounds()) 150 if (!window_state->HasRestoreBounds())
151 window_state->SaveCurrentBoundsForRestore(); 151 window_state->SaveCurrentBoundsForRestore();
152 152
153 gfx::Rect window_bounds = ScreenUtil::ConvertRectToScreen( 153 gfx::Rect window_bounds = window->GetBoundsInScreen();
flackr 2014/08/26 18:13:51 GetBoundsInScreen will be incorrect if this happen
rsadam 2014/08/26 18:46:28 Done.
154 window_,
155 window->GetTargetBounds());
156 gfx::Rect intersect = gfx::IntersectRects(window_bounds, new_bounds); 154 gfx::Rect intersect = gfx::IntersectRects(window_bounds, new_bounds);
157 int shift = std::min(intersect.height(), 155 int vertical_displacement = intersect.height() +
156 std::max(0, window_bounds.y() - new_bounds.y());
flackr 2014/08/26 18:13:52 This is somewhat confusing. Couldn't we just say w
rsadam 2014/08/26 18:46:28 Done.
157
158 // Prevent window from being pushed out of the work space.
159 int shift = std::min(vertical_displacement,
158 window->bounds().y() - work_area_in_parent_.y()); 160 window->bounds().y() - work_area_in_parent_.y());
159 if (shift > 0) { 161 if (shift > 0) {
160 gfx::Point origin(window->bounds().x(), window->bounds().y() - shift); 162 gfx::Point origin(window->bounds().x(), window->bounds().y() - shift);
161 SetChildBounds(window, gfx::Rect(origin, window->bounds().size())); 163 SetChildBounds(window, gfx::Rect(origin, window->bounds().size()));
162 } 164 }
163 } else if (window_state->HasRestoreBounds()) { 165 } else if (window_state->HasRestoreBounds()) {
164 // Keyboard hidden, restore original bounds if they exist. 166 // Keyboard hidden, restore original bounds if they exist.
165 window_state->SetAndClearRestoreBounds(); 167 window_state->SetAndClearRestoreBounds();
166 } 168 }
167 } 169 }
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 bool is_fullscreen = GetRootWindowController( 320 bool is_fullscreen = GetRootWindowController(
319 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; 321 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL;
320 if (is_fullscreen != is_fullscreen_) { 322 if (is_fullscreen != is_fullscreen_) {
321 ash::Shell::GetInstance()->NotifyFullscreenStateChange( 323 ash::Shell::GetInstance()->NotifyFullscreenStateChange(
322 is_fullscreen, window_->GetRootWindow()); 324 is_fullscreen, window_->GetRootWindow());
323 is_fullscreen_ = is_fullscreen; 325 is_fullscreen_ = is_fullscreen;
324 } 326 }
325 } 327 }
326 328
327 } // namespace ash 329 } // namespace ash
OLDNEW
« 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