Chromium Code Reviews| 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..42bc342bb068a1caa70e407d5bc1a63309fca8d2 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,34 @@ |
| [self addSection:autofill::SECTION_SHIPPING]; |
| [self setView:[[NSView alloc] init]]; |
| + for (AutofillSectionContainer* container in [details_ objectEnumerator]) |
|
Robert Sesek
2013/05/23 15:30:16
details_.get() instead of objectEnumerator
groby-ooo-7-16
2013/05/24 20:36:14
Done.
|
| + [[self view] addSubview:[container view]]; |
| + |
| + [self performLayout]; |
| +} |
| + |
| +- (NSSize)preferredSize { |
| + NSSize size = NSMakeSize(0, 0); |
| + for (AutofillSectionContainer* container in |
| + [details_ objectEnumerator]) { |
|
Robert Sesek
2013/05/23 15:30:16
same
groby-ooo-7-16
2013/05/24 20:36:14
Done.
|
| + 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 { |