diff --git a/AsyncDisplayKit/ASCollectionView.mm b/AsyncDisplayKit/ASCollectionView.mm index 108fc0f16b..b1b29335b3 100644 --- a/AsyncDisplayKit/ASCollectionView.mm +++ b/AsyncDisplayKit/ASCollectionView.mm @@ -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 diff --git a/AsyncDisplayKit/ASTableView.mm b/AsyncDisplayKit/ASTableView.mm index c4a65c598b..80f1894529 100644 --- a/AsyncDisplayKit/ASTableView.mm +++ b/AsyncDisplayKit/ASTableView.mm @@ -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 diff --git a/AsyncDisplayKit/Details/ASDataController.mm b/AsyncDisplayKit/Details/ASDataController.mm index 6a0c260463..7c0a7311d6 100644 --- a/AsyncDisplayKit/Details/ASDataController.mm +++ b/AsyncDisplayKit/Details/ASDataController.mm @@ -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; }]; }];