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

Unified Diff: chrome/browser/ui/views/constrained_window_views.cc

Issue 22903022: Limit constrained windows to the size of the parent view. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: No initializer Created 7 years, 3 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: chrome/browser/ui/views/constrained_window_views.cc
diff --git a/chrome/browser/ui/views/constrained_window_views.cc b/chrome/browser/ui/views/constrained_window_views.cc
index 07ba0048700603bcc7a39b8c64cb9ee8e410a747..3d2b47ae9b85fa481b0931d0cd81f31aa415782d 100644
--- a/chrome/browser/ui/views/constrained_window_views.cc
+++ b/chrome/browser/ui/views/constrained_window_views.cc
@@ -570,11 +570,19 @@ void ConstrainedWindowFrameView::InitClass() {
void UpdateWebContentsModalDialogPosition(
views::Widget* widget,
web_modal::WebContentsModalDialogHost* dialog_host) {
- gfx::Size size = widget->GetWindowBoundsInScreen().size();
- gfx::Point position = dialog_host->GetDialogPosition(size);
+ gfx::Size size = widget->GetRootView()->GetPreferredSize();
views::Border* border =
widget->non_client_view()->frame_view()->border();
+ gfx::Size max_size = dialog_host->GetMaximumDialogSize();
+ // Enlarge the max size by the top border, as the dialog will be shifted
+ // outside the area specified by the dialog host by this amount later in the
+ // function.
// Border may be null during widget initialization.
+ if (border)
+ max_size.Enlarge(0, border->GetInsets().top());
+ size.SetToMin(max_size);
+
+ gfx::Point position = dialog_host->GetDialogPosition(size);
if (border) {
// Align the first row of pixels inside the border. This is the apparent
// top of the dialog.
« no previous file with comments | « chrome/browser/ui/views/apps/native_app_window_views.cc ('k') | chrome/browser/ui/views/constrained_window_views_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698