Chromium Code Reviews| Index: ash/wm/window_positioning_utils.cc |
| diff --git a/ash/wm/window_positioning_utils.cc b/ash/wm/window_positioning_utils.cc |
| index 918f3e83211921ccbc8b0db1f721d0d071cbb669..f45ca4cb51cec22ec1c83455b1c4a9a9bd857606 100644 |
| --- a/ash/wm/window_positioning_utils.cc |
| +++ b/ash/wm/window_positioning_utils.cc |
| @@ -15,6 +15,8 @@ |
| #include "ash/wm/wm_event.h" |
| #include "ash/wm_window.h" |
| #include "ui/aura/client/focus_client.h" |
| +#include "ui/aura/window.h" |
| +#include "ui/aura/window_delegate.h" |
| #include "ui/aura/window_tracker.h" |
| #include "ui/display/display.h" |
| #include "ui/display/types/display_constants.h" |
| @@ -27,13 +29,13 @@ namespace wm { |
| namespace { |
| // Returns the default width of a snapped window. |
| -int GetDefaultSnappedWindowWidth(WmWindow* window) { |
| +int GetDefaultSnappedWindowWidth(aura::Window* window) { |
| const float kSnappedWidthWorkspaceRatio = 0.5f; |
| int work_area_width = |
| - ScreenUtil::GetDisplayWorkAreaBoundsInParent(window->aura_window()) |
| - .width(); |
| - int min_width = window->GetMinimumSize().width(); |
| + ScreenUtil::GetDisplayWorkAreaBoundsInParent(window).width(); |
| + int min_width = |
| + window->delegate() ? window->delegate()->GetMinimumSize().width() : 0; |
|
msw
2017/05/22 19:26:11
Is it okay for this to ignore WmWidow::use_empty_m
sky
2017/05/22 19:50:59
All tests pass with this patch, so currently yet.
|
| int ideal_width = |
| static_cast<int>(work_area_width * kSnappedWidthWorkspaceRatio); |
| return std::min(work_area_width, std::max(ideal_width, min_width)); |
| @@ -109,17 +111,17 @@ void AdjustBoundsToEnsureMinimumWindowVisibility(const gfx::Rect& visible_area, |
| kMinimumOnScreenArea, bounds); |
| } |
| -gfx::Rect GetDefaultLeftSnappedWindowBoundsInParent(WmWindow* window) { |
| +gfx::Rect GetDefaultLeftSnappedWindowBoundsInParent(aura::Window* window) { |
| gfx::Rect work_area_in_parent( |
| - ScreenUtil::GetDisplayWorkAreaBoundsInParent(window->aura_window())); |
| + ScreenUtil::GetDisplayWorkAreaBoundsInParent(window)); |
| return gfx::Rect(work_area_in_parent.x(), work_area_in_parent.y(), |
| GetDefaultSnappedWindowWidth(window), |
| work_area_in_parent.height()); |
| } |
| -gfx::Rect GetDefaultRightSnappedWindowBoundsInParent(WmWindow* window) { |
| +gfx::Rect GetDefaultRightSnappedWindowBoundsInParent(aura::Window* window) { |
| gfx::Rect work_area_in_parent( |
| - ScreenUtil::GetDisplayWorkAreaBoundsInParent(window->aura_window())); |
| + ScreenUtil::GetDisplayWorkAreaBoundsInParent(window)); |
| int width = GetDefaultSnappedWindowWidth(window); |
| return gfx::Rect(work_area_in_parent.right() - width, work_area_in_parent.y(), |
| width, work_area_in_parent.height()); |