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

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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = ScreenUtil::ConvertRectToScreen(
154 window_, 154 window_,
155 window->GetTargetBounds()); 155 window->GetTargetBounds());
156 gfx::Rect intersect = gfx::IntersectRects(window_bounds, new_bounds); 156 int vertical_displacement =
157 int shift = std::min(intersect.height(), 157 std::max(0, window_bounds.bottom() - new_bounds.y());
158 window->bounds().y() - work_area_in_parent_.y()); 158 int shift = std::min(vertical_displacement,
159 window_bounds.y() - work_area_in_parent_.y());
159 if (shift > 0) { 160 if (shift > 0) {
160 gfx::Point origin(window->bounds().x(), window->bounds().y() - shift); 161 gfx::Point origin(window_bounds.x(), window_bounds.y() - shift);
161 SetChildBounds(window, gfx::Rect(origin, window->bounds().size())); 162 SetChildBounds(window, gfx::Rect(origin, window_bounds.size()));
162 } 163 }
163 } else if (window_state->HasRestoreBounds()) { 164 } else if (window_state->HasRestoreBounds()) {
164 // Keyboard hidden, restore original bounds if they exist. 165 // Keyboard hidden, restore original bounds if they exist.
165 window_state->SetAndClearRestoreBounds(); 166 window_state->SetAndClearRestoreBounds();
166 } 167 }
167 } 168 }
168 169
169 ////////////////////////////////////////////////////////////////////////////// 170 //////////////////////////////////////////////////////////////////////////////
170 // WorkspaceLayoutManager, ash::ShellObserver implementation: 171 // WorkspaceLayoutManager, ash::ShellObserver implementation:
171 172
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 bool is_fullscreen = GetRootWindowController( 319 bool is_fullscreen = GetRootWindowController(
319 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; 320 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL;
320 if (is_fullscreen != is_fullscreen_) { 321 if (is_fullscreen != is_fullscreen_) {
321 ash::Shell::GetInstance()->NotifyFullscreenStateChange( 322 ash::Shell::GetInstance()->NotifyFullscreenStateChange(
322 is_fullscreen, window_->GetRootWindow()); 323 is_fullscreen, window_->GetRootWindow());
323 is_fullscreen_ = is_fullscreen; 324 is_fullscreen_ = is_fullscreen;
324 } 325 }
325 } 326 }
326 327
327 } // namespace ash 328 } // 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