Chromium Code Reviews| Index: ash/display/screen_position_controller.cc |
| diff --git a/ash/display/screen_position_controller.cc b/ash/display/screen_position_controller.cc |
| index e9f7a4297f27c700265e9caf65dd2768c9a31385..a654dc3fe5c5d579964822ffc688e85e93da5675 100644 |
| --- a/ash/display/screen_position_controller.cc |
| +++ b/ash/display/screen_position_controller.cc |
| @@ -11,6 +11,7 @@ |
| #include "ash/wm/coordinate_conversion.h" |
| #include "ash/wm/system_modal_container_layout_manager.h" |
| #include "ash/wm/window_properties.h" |
| +#include "ash/wm/window_state.h" |
| #include "ui/aura/client/activation_client.h" |
| #include "ui/aura/client/capture_client.h" |
| #include "ui/aura/client/focus_client.h" |
| @@ -191,6 +192,17 @@ void ScreenPositionController::SetBounds(aura::Window* window, |
| if (active && focused != active) |
| tracker.Add(active); |
| + window->parent()->RemoveChild(window); |
| + |
| + // Set new bounds now so that the container's layout manager |
| + // can adjust the bounds if necessary. |
| + gfx::Point origin = bounds.origin(); |
| + const gfx::Point display_origin = display.bounds().origin(); |
| + origin.Offset(-display_origin.x(), -display_origin.y()); |
| + gfx::Rect new_bounds = gfx::Rect(origin, bounds.size()); |
| + |
| + window->SetBounds(new_bounds); |
|
varkha
2014/01/02 22:42:42
I tried this in patch #1 of my CL (https://coderev
oshima
2014/01/08 02:16:11
What was broken? Drag code overrides the bounds af
|
| + |
| dst_container->AddChild(window); |
| MoveAllTransientChildrenToNewRoot(display, window); |
| @@ -204,9 +216,13 @@ void ScreenPositionController::SetBounds(aura::Window* window, |
| } else if (tracker.Contains(active)) { |
| activation_client->ActivateWindow(active); |
| } |
| + // TODO(oshima): We should not have to update the bounds again |
| + // below in theory, but we currently do need as there is a code |
| + // that assumes that the bounds will never be overridden by the |
| + // layout mananger. We should have more explicit control how |
| + // constraints are applied by the layout manager. |
| } |
| } |
| - |
| gfx::Point origin(bounds.origin()); |
| const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( |
| window).bounds().origin(); |