mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
[ASLayoutSpec] Remove cached ASTraitCollection
This commit is contained in:
@@ -1901,7 +1901,10 @@ void recursivelyTriggerDisplayForLayer(CALayer *layer, BOOL shouldBlock)
|
|||||||
if ((_methodOverrides & ASDisplayNodeMethodOverrideLayoutSpecThatFits) || _layoutSpecBlock != NULL) {
|
if ((_methodOverrides & ASDisplayNodeMethodOverrideLayoutSpecThatFits) || _layoutSpecBlock != NULL) {
|
||||||
ASLayoutSpec *layoutSpec = [self layoutSpecThatFits:constrainedSize];
|
ASLayoutSpec *layoutSpec = [self layoutSpecThatFits:constrainedSize];
|
||||||
layoutSpec.parent = self; // This causes upward propogation of any non-default layoutable values.
|
layoutSpec.parent = self; // This causes upward propogation of any non-default layoutable values.
|
||||||
layoutSpec.traitCollection = self.asyncTraitCollection;
|
|
||||||
|
// manually propagate the trait collection here so that any layoutSpec children of layoutSpec will get a traitCollection
|
||||||
|
ASEnvironmentStatePropagateDown(layoutSpec, self.environmentTraitCollection);
|
||||||
|
|
||||||
layoutSpec.isMutable = NO;
|
layoutSpec.isMutable = NO;
|
||||||
ASLayout *layout = [layoutSpec measureWithSizeRange:constrainedSize];
|
ASLayout *layout = [layoutSpec measureWithSizeRange:constrainedSize];
|
||||||
// Make sure layoutableObject of the root layout is `self`, so that the flattened layout will be structurally correct.
|
// Make sure layoutableObject of the root layout is `self`, so that the flattened layout will be structurally correct.
|
||||||
|
|||||||
@@ -11,8 +11,6 @@
|
|||||||
#import <AsyncDisplayKit/ASLayoutable.h>
|
#import <AsyncDisplayKit/ASLayoutable.h>
|
||||||
#import <AsyncDisplayKit/ASAsciiArtBoxCreator.h>
|
#import <AsyncDisplayKit/ASAsciiArtBoxCreator.h>
|
||||||
|
|
||||||
@class ASTraitCollection;
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
/** A layout spec is an immutable object that describes a layout, loosely inspired by React. */
|
/** A layout spec is an immutable object that describes a layout, loosely inspired by React. */
|
||||||
@@ -25,8 +23,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
*/
|
*/
|
||||||
@property (nonatomic, assign) BOOL isMutable;
|
@property (nonatomic, assign) BOOL isMutable;
|
||||||
|
|
||||||
@property (nonatomic, strong, nullable) ASTraitCollection *traitCollection;
|
|
||||||
|
|
||||||
- (instancetype)init;
|
- (instancetype)init;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -185,14 +185,6 @@
|
|||||||
return _children;
|
return _children;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setTraitCollection:(ASTraitCollection *)traitCollection
|
|
||||||
{
|
|
||||||
if ([traitCollection isEqualToTraitCollection:self.traitCollection] == NO) {
|
|
||||||
_traitCollection = traitCollection;
|
|
||||||
ASEnvironmentStatePropagateDown(self, [traitCollection environmentTraitCollection]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - ASEnvironment
|
#pragma mark - ASEnvironment
|
||||||
|
|
||||||
- (ASEnvironmentState)environmentState
|
- (ASEnvironmentState)environmentState
|
||||||
|
|||||||
Reference in New Issue
Block a user