Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(319)

Unified Diff: components/constrained_window/constrained_window_views.cc

Issue 2172363002: Created min size for print preview dialog and modified to allow the Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reduced diff Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}

Powered by Google App Engine
This is Rietveld 408576698