1 // Copyright 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_LAYOUT_H_ 6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_LAYOUT_H_ 7 8 #import <Cocoa/Cocoa.h> 9 10 // Defines a protocol that allows resizing a view hierarchy based on the size 11 // requirements of the subviews. Is implemented by either views or view 12 // controllers. 13 // The way this works together is: 14 // * Subview indicates by calling -requestRelayout on the window controller. 15 // * Window controller queries subviews for preferredSize to determine the 16 // total size of the contentView, adjusts subview origins appropriately, 17 // and calls performLayout on each subview. 18 // * Subviews then recursively do the same thing. 19 @protocol AutofillLayout 20 21 // Query the preferred size, without actually layouting. 22 // Akin to -intrinsicContentSize on 10.7 23 - (NSSize)preferredSize; 24 25 // Layout the content according to the preferred size. Will not touch 26 // frameOrigin. If all objects in the hierarchy were custom views (and not 27 // view controllers), this could be replaced by overriding 28 // -resizeSubviewsWithOldSize:. 29 - (void)performLayout; 30 31 @end 32 33 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_LAYOUT_H_ 34