mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-01 10:23:15 +00:00
- ASLayoutNode no longer has 'size' constraint during its initialization.. - ASLayoutNode no longer needs parentSize to calculate its layout.
43 lines
985 B
Plaintext
43 lines
985 B
Plaintext
/*
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*
|
|
*/
|
|
|
|
#import "ASCompositeNode.h"
|
|
|
|
#import "ASBaseDefines.h"
|
|
|
|
#import "ASDisplayNode.h"
|
|
#import "ASLayoutNodeSubclass.h"
|
|
|
|
@implementation ASCompositeNode
|
|
|
|
+ (instancetype)newWithDisplayNode:(ASDisplayNode *)displayNode
|
|
{
|
|
if (displayNode == nil) {
|
|
return nil;
|
|
}
|
|
ASCompositeNode *n = [super new];
|
|
if (n) {
|
|
n->_displayNode = displayNode;
|
|
}
|
|
return n;
|
|
}
|
|
|
|
+ (instancetype)new
|
|
{
|
|
ASDISPLAYNODE_NOT_DESIGNATED_INITIALIZER();
|
|
}
|
|
|
|
- (ASLayout *)computeLayoutThatFits:(ASSizeRange)constrainedSize
|
|
{
|
|
CGSize measuredSize = ASSizeRangeClamp(constrainedSize, [_displayNode measure:constrainedSize.max]);
|
|
return [ASLayout newWithNode:self size:measuredSize];
|
|
}
|
|
|
|
@end |