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

Side by Side Diff: ash/wm/system_modal_container_layout_manager.cc

Issue 277223004: Addressing dialog cropping by the virtual keyboard for M36 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/wm/system_modal_container_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/system_modal_container_layout_manager.h" 5 #include "ash/wm/system_modal_container_layout_manager.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "ash/session/session_state_delegate.h" 9 #include "ash/session/session_state_delegate.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 if (!bounds.IsEmpty()) { 265 if (!bounds.IsEmpty()) {
266 valid_bounds.set_height(std::max( 266 valid_bounds.set_height(std::max(
267 0, valid_bounds.height() - bounds.height())); 267 0, valid_bounds.height() - bounds.height()));
268 } 268 }
269 } 269 }
270 return valid_bounds; 270 return valid_bounds;
271 } 271 }
272 272
273 gfx::Rect SystemModalContainerLayoutManager::GetCenteredAndOrFittedBounds( 273 gfx::Rect SystemModalContainerLayoutManager::GetCenteredAndOrFittedBounds(
274 const aura::Window* window) { 274 const aura::Window* window) {
275 gfx::Rect target_bounds;
276 gfx::Rect usable_area = GetUsableDialogArea();
275 if (window->GetProperty(kCenteredKey)) { 277 if (window->GetProperty(kCenteredKey)) {
276 // Keep the dialog centered if it was centered before. 278 // Keep the dialog centered if it was centered before.
277 gfx::Rect target_bounds = GetUsableDialogArea(); 279 target_bounds = usable_area;
278 target_bounds.ClampToCenteredSize(window->bounds().size()); 280 target_bounds.ClampToCenteredSize(window->bounds().size());
279 return target_bounds; 281 } else {
282 // Keep the dialog within the usable area.
283 target_bounds = window->bounds();
284 target_bounds.AdjustToFit(usable_area);
280 } 285 }
281 gfx::Rect target_bounds = window->bounds(); 286 if (usable_area != container_->bounds()) {
282 target_bounds.AdjustToFit(GetUsableDialogArea()); 287 // Don't clamp the dialog for the keyboard. Keep the size as it is but make
288 // sure that the top remains visible.
289 // TODO(skuhne): M37 should add over scroll functionality to address this.
290 target_bounds.set_size(window->bounds().size());
291 }
283 return target_bounds; 292 return target_bounds;
284 } 293 }
285 294
286 bool SystemModalContainerLayoutManager::DialogIsCentered( 295 bool SystemModalContainerLayoutManager::DialogIsCentered(
287 const gfx::Rect& window_bounds) { 296 const gfx::Rect& window_bounds) {
288 gfx::Point window_center = window_bounds.CenterPoint(); 297 gfx::Point window_center = window_bounds.CenterPoint();
289 gfx::Point container_center = GetUsableDialogArea().CenterPoint(); 298 gfx::Point container_center = GetUsableDialogArea().CenterPoint();
290 return 299 return
291 std::abs(window_center.x() - container_center.x()) < kCenterPixelDelta && 300 std::abs(window_center.x() - container_center.x()) < kCenterPixelDelta &&
292 std::abs(window_center.y() - container_center.y()) < kCenterPixelDelta; 301 std::abs(window_center.y() - container_center.y()) < kCenterPixelDelta;
293 } 302 }
294 303
295 } // namespace ash 304 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/wm/system_modal_container_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698