mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
remove _child from ASLayoutSpec.mm. Store all children in the children array.
This commit is contained in:
@@ -68,9 +68,4 @@ static NSString * const kBackgroundChildKey = @"kBackgroundChildKey";
|
||||
return [super childForIdentifier:kBackgroundChildKey];
|
||||
}
|
||||
|
||||
- (void)setChildren:(NSArray *)children
|
||||
{
|
||||
ASDisplayNodeAssert(NO, @"not supported by this layout spec");
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -115,9 +115,4 @@ static CGFloat centerInset(CGFloat outer, CGFloat inner)
|
||||
return [ASLayout layoutWithLayoutableObject:self size:computedSize sublayouts:@[sublayout]];
|
||||
}
|
||||
|
||||
- (void)setChildren:(NSArray *)children
|
||||
{
|
||||
ASDisplayNodeAssert(NO, @"not supported by this layout spec");
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
ASEnvironmentState _environmentState;
|
||||
ASDN::RecursiveMutex _propertyLock;
|
||||
|
||||
id<ASLayoutable> _child;
|
||||
NSArray *_children;
|
||||
NSMutableDictionary *_childrenWithIdentifier;
|
||||
}
|
||||
@@ -118,7 +117,7 @@
|
||||
ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable");
|
||||
|
||||
id<ASLayoutable> finalLayoutable = [self layoutableToAddFromLayoutable:child];
|
||||
_child = finalLayoutable;
|
||||
_children = @[finalLayoutable];
|
||||
[self propagateUpLayoutable:finalLayoutable];
|
||||
}
|
||||
|
||||
@@ -128,6 +127,7 @@
|
||||
|
||||
id<ASLayoutable> finalLayoutable = [self layoutableToAddFromLayoutable:child];
|
||||
self.childrenWithIdentifier[identifier] = finalLayoutable;
|
||||
self.children = [self.children arrayByAddingObject:finalLayoutable];
|
||||
|
||||
// TODO: Should we propagate up the layoutable at it could happen that multiple children will propagated up their
|
||||
// layout options and one child will overwrite values from another child
|
||||
@@ -156,7 +156,7 @@
|
||||
|
||||
- (id<ASLayoutable>)child
|
||||
{
|
||||
return _child;
|
||||
return [_children firstObject];
|
||||
}
|
||||
|
||||
- (NSArray *)children
|
||||
|
||||
@@ -61,11 +61,6 @@ static NSString * const kOverlayChildKey = @"kOverlayChildKey";
|
||||
return [ASLayout layoutWithLayoutableObject:self size:contentsLayout.size sublayouts:sublayouts];
|
||||
}
|
||||
|
||||
- (void)setChildren:(NSArray *)children
|
||||
{
|
||||
ASDisplayNodeAssert(NO, @"not supported by this layout spec");
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation ASOverlayLayoutSpec (Debugging)
|
||||
|
||||
@@ -75,11 +75,6 @@
|
||||
return [ASLayout layoutWithLayoutableObject:self size:sublayout.size sublayouts:@[sublayout]];
|
||||
}
|
||||
|
||||
- (void)setChildren:(NSArray *)children
|
||||
{
|
||||
ASDisplayNodeAssert(NO, @"not supported by this layout spec");
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation ASRatioLayoutSpec (Debugging)
|
||||
|
||||
@@ -92,11 +92,6 @@
|
||||
return [ASLayout layoutWithLayoutableObject:self size:size sublayouts:@[sublayout]];
|
||||
}
|
||||
|
||||
- (void)setChildren:(NSArray *)children
|
||||
{
|
||||
ASDisplayNodeAssert(NO, @"not supported by this layout spec");
|
||||
}
|
||||
|
||||
- (CGFloat)proportionOfAxisForAxisPosition:(ASRelativeLayoutSpecPosition)position
|
||||
{
|
||||
if ((position & ASRelativeLayoutSpecPositionCenter) != 0) {
|
||||
|
||||
@@ -121,17 +121,6 @@
|
||||
_baselineRelativeArrangement = baselineRelativeArrangement;
|
||||
}
|
||||
|
||||
- (void)setChild:(id<ASLayoutable>)child forIdentifier:(NSString *)identifier
|
||||
{
|
||||
ASDisplayNodeAssert(NO, @"ASStackLayoutSpec only supports setChildren");
|
||||
}
|
||||
|
||||
- (id<ASLayoutable>)childForIdentifier:(NSString *)identifier
|
||||
{
|
||||
ASDisplayNodeAssert(NO, @"ASStackLayoutSpec only supports children");
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (ASLayout *)measureWithSizeRange:(ASSizeRange)constrainedSize
|
||||
{
|
||||
if (self.children.count == 0) {
|
||||
|
||||
@@ -72,17 +72,6 @@
|
||||
sublayouts:sublayouts];
|
||||
}
|
||||
|
||||
- (void)setChild:(id<ASLayoutable>)child forIdentifier:(NSString *)identifier
|
||||
{
|
||||
ASDisplayNodeAssert(NO, @"ASStaticLayoutSpec only supports setChildren");
|
||||
}
|
||||
|
||||
- (id<ASLayoutable>)childForIdentifier:(NSString *)identifier
|
||||
{
|
||||
ASDisplayNodeAssert(NO, @"ASStaticLayoutSpec only supports children");
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation ASStaticLayoutSpec (ASEnvironment)
|
||||
|
||||
Reference in New Issue
Block a user