Index: chrome/browser/ui/cocoa/autofill/autofill_details_container.mm |
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_details_container.mm b/chrome/browser/ui/cocoa/autofill/autofill_details_container.mm |
index 56c20b8b5c018aa097df195a4b14b2201e7bfe96..5a88597af879c908965acf91af53d953a8bddcdc 100644 |
--- a/chrome/browser/ui/cocoa/autofill/autofill_details_container.mm |
+++ b/chrome/browser/ui/cocoa/autofill/autofill_details_container.mm |
@@ -4,6 +4,8 @@ |
#import "chrome/browser/ui/cocoa/autofill/autofill_details_container.h" |
+#include <algorithm> |
+ |
#include "chrome/browser/ui/autofill/autofill_dialog_controller.h" |
#import "chrome/browser/ui/cocoa/autofill/autofill_section_container.h" |
@@ -33,15 +35,33 @@ |
[self addSection:autofill::SECTION_SHIPPING]; |
[self setView:[[NSView alloc] init]]; |
+ for (AutofillSectionContainer* container in details_.get()) |
+ [[self view] addSubview:[container view]]; |
+ |
+ [self performLayout]; |
+} |
+ |
+- (NSSize)preferredSize { |
+ NSSize size = NSMakeSize(0, 0); |
+ for (AutofillSectionContainer* container in details_.get()) { |
+ NSSize containerSize = [container preferredSize]; |
+ size.height += containerSize.height; |
+ size.width = std::max(containerSize.width, size.width); |
+ } |
+ return size; |
+} |
+ |
+- (void)performLayout { |
NSRect rect = NSZeroRect; |
for (AutofillSectionContainer* container in |
[details_ reverseObjectEnumerator]) { |
+ [container performLayout]; |
[[container view] setFrameOrigin:NSMakePoint(0, NSMaxY(rect))]; |
rect = NSUnionRect(rect, [[container view] frame]); |
- [[self view] addSubview:[container view]]; |
} |
- [[self view] setFrame:rect]; |
+ |
+ [[self view] setFrameSize:[self preferredSize]]; |
} |
- (AutofillSectionContainer*)sectionForId:(autofill::DialogSection)section { |