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

Unified Diff: chrome/browser/ui/cocoa/constrained_window/constrained_window_web_dialog_sheet.mm

Issue 1796273004: [Reland] Enable AutoResize for Constrained Web Dialogs for Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 9 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/cocoa/constrained_window/constrained_window_web_dialog_sheet.mm
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_web_dialog_sheet.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_web_dialog_sheet.mm
index 3c71f00e0a19063454872beb63e876e6bea5a0f5..775ae154665490be79c47801ddf24210e1f13479 100644
--- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_web_dialog_sheet.mm
+++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_web_dialog_sheet.mm
@@ -22,9 +22,25 @@
if (web_dialog_delegate_) {
gfx::Size size;
web_dialog_delegate_->GetDialogSize(&size);
- [customWindow_ setContentSize:NSMakeSize(size.width(), size.height())];
+
+ // If the dialog has autoresizing enabled, |size| will be empty. Use the
+ // last known dialog size.
+ NSSize content_size = size.IsEmpty() ? current_size_ :
+ NSMakeSize(size.width(), size.height());
+ [customWindow_ setContentSize:content_size];
}
[super updateSheetPosition];
}
+- (void)resizeWithNewSize:(NSSize)size {
+ current_size_ = size;
+ [customWindow_ setContentSize:current_size_];
+
+ // self's updateSheetPosition() sets |customWindow_|'s contentSize to a
+ // fixed dialog size. Here, we want to resize to |size| instead. Use
+ // super rather than self to bypass the setContentSize() call for the fixed
+ // size.
+ [super updateSheetPosition];
+}
+
@end

Powered by Google App Engine
This is Rietveld 408576698