| 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 3ed86ce06852a9da707d5868000e19a7103a8b7d..6b634e5b2e5b05168c89d799a239d1ed7d3477b2 100644
|
| --- a/components/constrained_window/constrained_window_views.cc
|
| +++ b/components/constrained_window/constrained_window_views.cc
|
| @@ -13,6 +13,7 @@
|
| #include "components/web_modal/web_contents_modal_dialog_host.h"
|
| #include "components/web_modal/web_contents_modal_dialog_manager.h"
|
| #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h"
|
| +#include "ui/display/screen.h"
|
| #include "ui/views/border.h"
|
| #include "ui/views/widget/widget.h"
|
| #include "ui/views/widget/widget_observer.h"
|
| @@ -108,8 +109,14 @@ void UpdateModalDialogPosition(views::Widget* widget,
|
| position.set_y(position.y() - border->GetInsets().top());
|
| }
|
|
|
| - if (widget->is_top_level())
|
| + if (widget->is_top_level()) {
|
| position += host_widget->GetClientAreaBoundsInScreen().OffsetFromOrigin();
|
| + // If the dialog extends partially off any display, clamp its position to
|
| + // be fully visible within that display. If the dialog doesn't intersect
|
| + // with any display clamp its position to be fully on the nearest display.
|
| + position = display::Screen::MoveScreenRectToNearestDisplay(
|
| + gfx::Rect(position, size)).origin();
|
| + }
|
|
|
| widget->SetBounds(gfx::Rect(position, size));
|
| }
|
|
|