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

Unified Diff: chrome/browser/ui/cocoa/autofill/autofill_details_container.mm

Issue 15645004: [rAC] Allow sub-views to trigger layout reflow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review issues. Created 7 years, 7 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/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 {

Powered by Google App Engine
This is Rietveld 408576698