mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Remove needsMeasure
This commit is contained in:
@@ -12,9 +12,7 @@
|
|||||||
/**
|
/**
|
||||||
* Generic cell node. Subclass this instead of `ASDisplayNode` to use with `ASTableView` and `ASCollectionView`.
|
* Generic cell node. Subclass this instead of `ASDisplayNode` to use with `ASTableView` and `ASCollectionView`.
|
||||||
*/
|
*/
|
||||||
@interface ASCellNode : ASDisplayNode {
|
@interface ASCellNode : ASDisplayNode
|
||||||
BOOL _needsMeasure;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @abstract When enabled, ensures that the cell is completely displayed before allowed onscreen.
|
* @abstract When enabled, ensures that the cell is completely displayed before allowed onscreen.
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
// use UITableViewCell defaults
|
// use UITableViewCell defaults
|
||||||
_selectionStyle = UITableViewCellSelectionStyleDefault;
|
_selectionStyle = UITableViewCellSelectionStyleDefault;
|
||||||
self.clipsToBounds = YES;
|
self.clipsToBounds = YES;
|
||||||
_needsMeasure = YES;
|
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
#import "ASDisplayNode.h"
|
#import "ASDisplayNode.h"
|
||||||
#import "ASMultidimensionalArrayUtils.h"
|
#import "ASMultidimensionalArrayUtils.h"
|
||||||
#import "ASDisplayNodeInternal.h"
|
#import "ASDisplayNodeInternal.h"
|
||||||
#import "ASCellNodeInternal.h"
|
|
||||||
|
|
||||||
//#define LOG(...) NSLog(__VA_ARGS__)
|
//#define LOG(...) NSLog(__VA_ARGS__)
|
||||||
#define LOG(...)
|
#define LOG(...)
|
||||||
@@ -106,11 +105,10 @@ static void *kASSizingQueueContext = &kASSizingQueueContext;
|
|||||||
|
|
||||||
[indexPaths enumerateObjectsUsingBlock:^(NSIndexPath *indexPath, NSUInteger idx, __unused BOOL * stop) {
|
[indexPaths enumerateObjectsUsingBlock:^(NSIndexPath *indexPath, NSUInteger idx, __unused BOOL * stop) {
|
||||||
ASCellNode *node = nodes[idx];
|
ASCellNode *node = nodes[idx];
|
||||||
if (node.isNodeLoaded && node.needsMeasure) {
|
if (node.isNodeLoaded) {
|
||||||
ASSizeRange constrainedSize = [_dataSource dataController:self constrainedSizeForNodeAtIndexPath:indexPath];
|
ASSizeRange constrainedSize = [_dataSource dataController:self constrainedSizeForNodeAtIndexPath:indexPath];
|
||||||
[node measureWithSizeRange:constrainedSize];
|
[node measureWithSizeRange:constrainedSize];
|
||||||
node.frame = CGRectMake(0.0f, 0.0f, node.calculatedSize.width, node.calculatedSize.height);
|
node.frame = CGRectMake(0.0f, 0.0f, node.calculatedSize.width, node.calculatedSize.height);
|
||||||
node.needsMeasure = NO;
|
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
@@ -130,7 +128,7 @@ static void *kASSizingQueueContext = &kASSizingQueueContext;
|
|||||||
|
|
||||||
for (NSUInteger k = j; k < j + batchCount; k++) {
|
for (NSUInteger k = j; k < j + batchCount; k++) {
|
||||||
ASCellNode *node = nodes[k];
|
ASCellNode *node = nodes[k];
|
||||||
if (node.needsMeasure) {
|
if (!node.isNodeLoaded) {
|
||||||
nodeBoundSizes[k] = [_dataSource dataController:self constrainedSizeForNodeAtIndexPath:indexPaths[k]];
|
nodeBoundSizes[k] = [_dataSource dataController:self constrainedSizeForNodeAtIndexPath:indexPaths[k]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -138,12 +136,11 @@ static void *kASSizingQueueContext = &kASSizingQueueContext;
|
|||||||
dispatch_group_async(layoutGroup, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
dispatch_group_async(layoutGroup, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||||
for (NSUInteger k = j; k < j + batchCount; k++) {
|
for (NSUInteger k = j; k < j + batchCount; k++) {
|
||||||
ASCellNode *node = nodes[k];
|
ASCellNode *node = nodes[k];
|
||||||
if (node.needsMeasure) {
|
if (!node.isNodeLoaded) {
|
||||||
ASDisplayNodeAssert(!node.isNodeLoaded, @"Nodes that are loaded should already have been measured on the main thread.");
|
ASDisplayNodeAssert(!node.isNodeLoaded, @"Nodes that are loaded should already have been measured on the main thread.");
|
||||||
ASSizeRange constrainedSize = nodeBoundSizes[k];
|
ASSizeRange constrainedSize = nodeBoundSizes[k];
|
||||||
[node measureWithSizeRange:constrainedSize];
|
[node measureWithSizeRange:constrainedSize];
|
||||||
node.frame = CGRectMake(0.0f, 0.0f, node.calculatedSize.width, node.calculatedSize.height);
|
node.frame = CGRectMake(0.0f, 0.0f, node.calculatedSize.width, node.calculatedSize.height);
|
||||||
node.needsMeasure = NO;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -616,7 +613,6 @@ static void *kASSizingQueueContext = &kASSizingQueueContext;
|
|||||||
ASSizeRange constrainedSize = [_dataSource dataController:self constrainedSizeForNodeAtIndexPath:indexPath];
|
ASSizeRange constrainedSize = [_dataSource dataController:self constrainedSizeForNodeAtIndexPath:indexPath];
|
||||||
[node measureWithSizeRange:constrainedSize];
|
[node measureWithSizeRange:constrainedSize];
|
||||||
node.frame = CGRectMake(0.0f, 0.0f, node.calculatedSize.width, node.calculatedSize.height);
|
node.frame = CGRectMake(0.0f, 0.0f, node.calculatedSize.width, node.calculatedSize.height);
|
||||||
node.needsMeasure = NO;
|
|
||||||
}];
|
}];
|
||||||
}];
|
}];
|
||||||
}];
|
}];
|
||||||
|
|||||||
Reference in New Issue
Block a user