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 |