Commit 3045a6e2 authored by Robert Liao's avatar Robert Liao Committed by Commit Bot

Set a ConstrainedDialogWebView Minimum Size of 1x1 on Mac

MacOS does not handle zero-sized windows well.

BUG=854267

Change-Id: I3da67cef7abdc035ca6378d5cb31dc68a097ee67
Reviewed-on: https://chromium-review.googlesource.com/1109200Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Robert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569402}
parent f68571e3
...@@ -42,6 +42,17 @@ class InitiatorWebContentsObserver ...@@ -42,6 +42,17 @@ class InitiatorWebContentsObserver
DISALLOW_COPY_AND_ASSIGN(InitiatorWebContentsObserver); DISALLOW_COPY_AND_ASSIGN(InitiatorWebContentsObserver);
}; };
gfx::Size RestrictToPlatformMinimumSize(const gfx::Size& min_size) {
#if defined(OS_MACOSX)
// http://crbug.com/78973 - MacOS does not handle zero-sized windows well.
gfx::Size adjusted_min_size(1, 1);
adjusted_min_size.SetToMax(min_size);
return adjusted_min_size;
#else
return min_size;
#endif
}
// The specialized WebView that lives in a constrained dialog. // The specialized WebView that lives in a constrained dialog.
class ConstrainedDialogWebView : public views::WebView, class ConstrainedDialogWebView : public views::WebView,
public ConstrainedWebDialogDelegate, public ConstrainedWebDialogDelegate,
...@@ -224,7 +235,7 @@ ConstrainedDialogWebView::ConstrainedDialogWebView( ...@@ -224,7 +235,7 @@ ConstrainedDialogWebView::ConstrainedDialogWebView(
delegate, delegate,
&initiator_observer_, &initiator_observer_,
this)), this)),
min_size_(min_size), min_size_(RestrictToPlatformMinimumSize(min_size)),
max_size_(max_size) { max_size_(max_size) {
SetWebContents(GetWebContents()); SetWebContents(GetWebContents());
AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)); AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment