mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-16 19:30:29 +00:00
Cleanup Yoga Categories (#1364)
This commit is contained in:
parent
dd4359db7b
commit
07becd0fc8
@ -1046,10 +1046,7 @@ ASLayoutElementStyleExtensibilityForwarding
|
|||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark - ASDisplayNode (YogaLayout)
|
#pragma mark - ASDisplayNode (YogaLayout)
|
||||||
|
|
||||||
@implementation ASDisplayNode (YogaInternal)
|
@implementation ASDisplayNode (YogaLayout)
|
||||||
|
|
||||||
#pragma mark -
|
|
||||||
#pragma mark - ASDisplayNode (Yoga)
|
|
||||||
|
|
||||||
- (BOOL)locked_shouldLayoutFromYogaRoot {
|
- (BOOL)locked_shouldLayoutFromYogaRoot {
|
||||||
#if YOGA
|
#if YOGA
|
||||||
@ -1071,32 +1068,4 @@ ASLayoutElementStyleExtensibilityForwarding
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
- (ASLockSet)lockToRootIfNeededForLayout {
|
|
||||||
ASLockSet lockSet = ASLockSequence(^BOOL(ASAddLockBlock addLock) {
|
|
||||||
if (!addLock(self)) {
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
#if YOGA
|
|
||||||
if (![self locked_shouldLayoutFromYogaRoot]) {
|
|
||||||
return YES;
|
|
||||||
}
|
|
||||||
if (self.nodeController && !addLock(self.nodeController)) {
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
ASDisplayNode *parent = _supernode;
|
|
||||||
while (parent) {
|
|
||||||
if (!addLock(parent)) {
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
if (parent.nodeController && !addLock(parent.nodeController)) {
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
parent = parent->_supernode;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
return lockSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -33,6 +33,10 @@ AS_EXTERN void ASDisplayNodePerformBlockOnEveryYogaChild(ASDisplayNode * _Nullab
|
|||||||
// Will walk up the Yoga tree and returns the root node
|
// Will walk up the Yoga tree and returns the root node
|
||||||
- (ASDisplayNode *)yogaRoot;
|
- (ASDisplayNode *)yogaRoot;
|
||||||
|
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface ASDisplayNode (YogaLocking)
|
||||||
/**
|
/**
|
||||||
* @discussion Attempts(spinning) to lock all node up to root node when yoga is enabled.
|
* @discussion Attempts(spinning) to lock all node up to root node when yoga is enabled.
|
||||||
* This will lock self when yoga is not enabled;
|
* This will lock self when yoga is not enabled;
|
||||||
|
|||||||
@ -20,6 +20,7 @@
|
|||||||
#import <AsyncDisplayKit/ASDisplayNodeInternal.h>
|
#import <AsyncDisplayKit/ASDisplayNodeInternal.h>
|
||||||
#import <AsyncDisplayKit/ASLayout.h>
|
#import <AsyncDisplayKit/ASLayout.h>
|
||||||
#import <AsyncDisplayKit/ASLayoutElementStylePrivate.h>
|
#import <AsyncDisplayKit/ASLayoutElementStylePrivate.h>
|
||||||
|
#import <AsyncDisplayKit/ASNodeController+Beta.h>
|
||||||
|
|
||||||
#import <AsyncDisplayKit/ASDisplayNode+LayoutSpec.h>
|
#import <AsyncDisplayKit/ASDisplayNode+LayoutSpec.h>
|
||||||
|
|
||||||
@ -27,7 +28,7 @@
|
|||||||
|
|
||||||
#pragma mark - ASDisplayNode+Yoga
|
#pragma mark - ASDisplayNode+Yoga
|
||||||
|
|
||||||
@interface ASDisplayNode (YogaInternal)
|
@interface ASDisplayNode (YogaPrivate)
|
||||||
@property (nonatomic, weak) ASDisplayNode *yogaParent;
|
@property (nonatomic, weak) ASDisplayNode *yogaParent;
|
||||||
- (ASSizeRange)_locked_constrainedSizeForLayoutPass;
|
- (ASSizeRange)_locked_constrainedSizeForLayoutPass;
|
||||||
@end
|
@end
|
||||||
@ -409,6 +410,40 @@
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
#pragma mark - ASDisplayNode (YogaLocking)
|
||||||
|
|
||||||
|
@implementation ASDisplayNode (YogaLocking)
|
||||||
|
|
||||||
|
- (ASLockSet)lockToRootIfNeededForLayout {
|
||||||
|
ASLockSet lockSet = ASLockSequence(^BOOL(ASAddLockBlock addLock) {
|
||||||
|
if (!addLock(self)) {
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
#if YOGA
|
||||||
|
if (![self locked_shouldLayoutFromYogaRoot]) {
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
if (self.nodeController && !addLock(self.nodeController)) {
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
ASDisplayNode *parent = _supernode;
|
||||||
|
while (parent) {
|
||||||
|
if (!addLock(parent)) {
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
if (parent.nodeController && !addLock(parent.nodeController)) {
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
parent = parent->_supernode;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
return lockSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation ASDisplayNode (YogaDebugging)
|
@implementation ASDisplayNode (YogaDebugging)
|
||||||
|
|
||||||
- (NSString *)yogaTreeDescription {
|
- (NSString *)yogaTreeDescription {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user