Small changes required by the coming layout debugger (#337)

* Small changes required by the layout debugger
- `ASDisplayNode` can be told to not flatten its layout immediately but later on. The unflattened layout is also stored in a separate property. It's needed for inspecting not only display nodes but also layout specs used to compute a layout tree.
- `ASLayout` can be told to always retain its sublayout elements. This is needed especially for layout specs since they are usually not retained after an ASLayout was computed.

* Update CHANGELOG

* Address comments
This commit is contained in:
Huy Nguyen
2017-06-08 10:47:50 -07:00
committed by GitHub
parent 13c467b2f4
commit 05e9bdd092
8 changed files with 87 additions and 5 deletions

View File

@@ -553,6 +553,30 @@ extern NSInteger const ASDefaultDrawingPriority;
*/
@interface ASDisplayNode (Debugging) <ASDebugNameProvider>
/**
* Set to YES to tell all ASDisplayNode instances to store their unflattened layouts.
*
* The layout can be accessed via `-unflattenedCalculatedLayout`.
*
* Flattened layouts use less memory and are faster to lookup. On the other hand, unflattened layouts are useful for debugging
* because they preserve original information.
*/
+ (void)setShouldStoreUnflattenedLayouts:(BOOL)shouldStore;
/**
* Whether or not ASDisplayNode instances should store their unflattened layouts.
*
* The layout can be accessed via `-unflattenedCalculatedLayout`.
*
* Flattened layouts use less memory and are faster to lookup. On the other hand, unflattened layouts are useful for debugging
* because they preserve original information.
*
* Defaults to NO.
*/
+ (BOOL)shouldStoreUnflattenedLayouts;
@property (nonatomic, strong, readonly, nullable) ASLayout *unflattenedCalculatedLayout;
/**
* @abstract Return a description of the node hierarchy.
*