Chromium Code Reviews| Index: components/constrained_window/constrained_window_views.cc |
| diff --git a/components/constrained_window/constrained_window_views.cc b/components/constrained_window/constrained_window_views.cc |
| index def5232fc9782603559d380c6499264f1c8ac6b5..2db4aaa694366e6461df3478e499c70b72bf3878 100644 |
| --- a/components/constrained_window/constrained_window_views.cc |
| +++ b/components/constrained_window/constrained_window_views.cc |
| @@ -91,13 +91,22 @@ void UpdateModalDialogPosition(views::Widget* widget, |
| // top of the dialog. |
| position.set_y(position.y() - border->GetInsets().top()); |
| } |
| - |
| if (widget->is_top_level()) { |
| - position += |
| + if (!widget->IsModalTypeChild()) |
| + position += |
| views::Widget::GetWidgetForNativeView(dialog_host->GetHostView())-> |
| GetClientAreaBoundsInScreen().OffsetFromOrigin(); |
| - } |
| + if (widget->IsModalTypeChild()) { |
|
Mike Wittman
2016/07/26 17:27:35
nit: if else
rbpotter
2016/07/26 21:48:19
Acknowledged.
|
| + gfx::Rect bound = |
| + views::Widget::GetWidgetForNativeView(dialog_host->GetHostView())-> |
| + GetClientAreaBoundsInScreen(); |
| + if (bound.width() - border->GetInsets().left() < size.width()) { |
| + position.set_x(position.x() + (size.width()-bound.width())/2 + |
| + border->GetInsets().left()); |
| + } |
| + } |
| + } |
| widget->SetBounds(gfx::Rect(position, size)); |
| } |
| @@ -122,7 +131,8 @@ void UpdateWebContentsModalDialogPosition( |
| // Border may be null during widget initialization. |
| if (border) |
| max_size.Enlarge(0, border->GetInsets().top()); |
| - size.SetToMin(max_size); |
| + if (!widget->is_top_level()) |
| + size.SetToMin(max_size); |
| UpdateModalDialogPosition(widget, dialog_host, size); |
| } |