Index: ash/wm/system_modal_container_layout_manager.cc |
diff --git a/ash/wm/system_modal_container_layout_manager.cc b/ash/wm/system_modal_container_layout_manager.cc |
index c16d267057d19b91d5e6ecbf1dcacdb77482defd..8c32215bd16d0cbbec387c48d8cff26da00e892a 100644 |
--- a/ash/wm/system_modal_container_layout_manager.cc |
+++ b/ash/wm/system_modal_container_layout_manager.cc |
@@ -272,14 +272,23 @@ gfx::Rect SystemModalContainerLayoutManager::GetUsableDialogArea() { |
gfx::Rect SystemModalContainerLayoutManager::GetCenteredAndOrFittedBounds( |
const aura::Window* window) { |
+ gfx::Rect target_bounds; |
+ gfx::Rect usable_area = GetUsableDialogArea(); |
if (window->GetProperty(kCenteredKey)) { |
// Keep the dialog centered if it was centered before. |
- gfx::Rect target_bounds = GetUsableDialogArea(); |
+ target_bounds = usable_area; |
target_bounds.ClampToCenteredSize(window->bounds().size()); |
- return target_bounds; |
+ } else { |
+ // Keep the dialog within the usable area. |
+ target_bounds = window->bounds(); |
+ target_bounds.AdjustToFit(usable_area); |
+ } |
+ if (usable_area != container_->bounds()) { |
+ // Don't clamp the dialog for the keyboard. Keep the size as it is but make |
+ // sure that the top remains visible. |
+ // TODO(skuhne): M37 should add over scroll functionality to address this. |
+ target_bounds.set_size(window->bounds().size()); |
} |
- gfx::Rect target_bounds = window->bounds(); |
- target_bounds.AdjustToFit(GetUsableDialogArea()); |
return target_bounds; |
} |