mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-01-06 21:22:44 +00:00
Put back the frame-setting behavior when measuring cell nodes
This commit is contained in:
@@ -423,12 +423,7 @@ static BOOL _isInterceptedSelector(SEL sel)
|
||||
|
||||
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
ASCellNode *node = [_dataController nodeAtIndexPath:indexPath];
|
||||
CGSize size = node.calculatedSize;
|
||||
if (!CGSizeEqualToSize(size, node.frame.size)) {
|
||||
node.frame = CGRectMake(0, 0, size.width, size.height);
|
||||
}
|
||||
return size;
|
||||
return [[_dataController nodeAtIndexPath:indexPath] calculatedSize];
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
|
||||
|
||||
@@ -537,12 +537,7 @@ void ASPerformBlockWithoutAnimation(BOOL withoutAnimation, void (^block)()) {
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
ASCellNode *node = [_dataController nodeAtIndexPath:indexPath];
|
||||
CGSize size = node.calculatedSize;
|
||||
// Update node's frame to ensure it will fill its cell.
|
||||
if (!CGSizeEqualToSize(node.frame.size, size)) {
|
||||
node.frame = CGRectMake(0, 0, size.width, size.height);
|
||||
}
|
||||
return size.height;
|
||||
return node.calculatedSize.height;
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
||||
|
||||
@@ -98,7 +98,7 @@ static void *kASSizingQueueContext = &kASSizingQueueContext;
|
||||
#pragma mark - Cell Layout
|
||||
|
||||
/*
|
||||
* Once nodes have loaded their views, we can't measure in the background so this is a chance
|
||||
* Once nodes have loaded their views, we can't layout in the background so this is a chance
|
||||
* to do so immediately on the main thread.
|
||||
*/
|
||||
- (void)_layoutNodesWithMainThreadAffinity:(NSArray *)nodes atIndexPaths:(NSArray *)indexPaths {
|
||||
@@ -109,12 +109,12 @@ static void *kASSizingQueueContext = &kASSizingQueueContext;
|
||||
if (node.isNodeLoaded && node.needsMeasure) {
|
||||
ASSizeRange constrainedSize = [_dataSource dataController:self constrainedSizeForNodeAtIndexPath:indexPath];
|
||||
[node measureWithSizeRange:constrainedSize];
|
||||
node.frame = CGRectMake(0.0f, 0.0f, node.calculatedSize.width, node.calculatedSize.height);
|
||||
node.needsMeasure = NO;
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
// FIXME: Isn't this name sort of misleading? We don't lay the node out we just measure it. _measureNodes?
|
||||
- (void)_layoutNodes:(NSArray *)nodes atIndexPaths:(NSArray *)indexPaths withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions
|
||||
{
|
||||
ASDisplayNodeAssert([NSOperationQueue currentQueue] == _editingTransactionQueue, @"Cell node layout must be initiated from edit transaction queue");
|
||||
@@ -142,6 +142,7 @@ static void *kASSizingQueueContext = &kASSizingQueueContext;
|
||||
ASDisplayNodeAssert(!node.isNodeLoaded, @"Nodes that are loaded should already have been measured on the main thread.");
|
||||
ASSizeRange constrainedSize = nodeBoundSizes[k];
|
||||
[node measureWithSizeRange:constrainedSize];
|
||||
node.frame = CGRectMake(0.0f, 0.0f, node.calculatedSize.width, node.calculatedSize.height);
|
||||
node.needsMeasure = NO;
|
||||
}
|
||||
}
|
||||
@@ -614,6 +615,7 @@ static void *kASSizingQueueContext = &kASSizingQueueContext;
|
||||
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:rowIndex inSection:sectionIndex];
|
||||
ASSizeRange constrainedSize = [_dataSource dataController:self constrainedSizeForNodeAtIndexPath:indexPath];
|
||||
[node measureWithSizeRange:constrainedSize];
|
||||
node.frame = CGRectMake(0.0f, 0.0f, node.calculatedSize.width, node.calculatedSize.height);
|
||||
node.needsMeasure = NO;
|
||||
}];
|
||||
}];
|
||||
|
||||
Reference in New Issue
Block a user