diff --git a/AsyncDisplayKit/ASCellNode.h b/AsyncDisplayKit/ASCellNode.h index 6b038ee853..78821ef2d8 100644 --- a/AsyncDisplayKit/ASCellNode.h +++ b/AsyncDisplayKit/ASCellNode.h @@ -15,13 +15,13 @@ typedef NSUInteger ASCellNodeAnimation; @protocol ASCellNodeLayoutDelegate /** - * Notifies the delegate that the specified cell node has done a relayout - * that resulted in a change of `calculatedSize`. + * Notifies the delegate that the specified cell node has done a relayout. * The notification is done on main thread. * * @param node A node informing the delegate about the relayout. + * @param sizeChanged `YES` if the node's `calculatedSize` changed during the relayout, `NO` otherwise. */ -- (void)nodeDidRelayoutWithSizeChange:(ASCellNode *)node; +- (void)nodeDidRelayout:(ASCellNode *)node sizeChanged:(BOOL)sizeChanged; @end /** diff --git a/AsyncDisplayKit/ASCellNode.m b/AsyncDisplayKit/ASCellNode.m index 029de4b8a4..50ad035702 100644 --- a/AsyncDisplayKit/ASCellNode.m +++ b/AsyncDisplayKit/ASCellNode.m @@ -55,10 +55,11 @@ ASDisplayNodeAssertThreadAffinity(self); CGSize oldSize = self.calculatedSize; [super setNeedsLayout]; - - if (_layoutDelegate != nil && !CGSizeEqualToSize(oldSize, self.calculatedSize)) { + + if (_layoutDelegate != nil) { + BOOL sizeChanged = !CGSizeEqualToSize(oldSize, self.calculatedSize); ASPerformBlockOnMainThread(^{ - [_layoutDelegate nodeDidRelayoutWithSizeChange:self]; + [_layoutDelegate nodeDidRelayout:self sizeChanged:sizeChanged]; }); } } diff --git a/AsyncDisplayKit/ASCollectionView.mm b/AsyncDisplayKit/ASCollectionView.mm index 0c1f7e9961..57b37104df 100644 --- a/AsyncDisplayKit/ASCollectionView.mm +++ b/AsyncDisplayKit/ASCollectionView.mm @@ -913,11 +913,11 @@ static BOOL _isInterceptedSelector(SEL sel) #pragma mark - ASCellNodeDelegate -- (void)nodeDidRelayoutWithSizeChange:(ASCellNode *)node +- (void)nodeDidRelayout:(ASCellNode *)node sizeChanged:(BOOL)sizeChanged { ASDisplayNodeAssertMainThread(); - if (_queuedNodeSizeUpdate) { + if (!sizeChanged || _queuedNodeSizeUpdate) { return; } diff --git a/AsyncDisplayKit/ASTableView.mm b/AsyncDisplayKit/ASTableView.mm index 295e592a7e..4bd5ef2639 100644 --- a/AsyncDisplayKit/ASTableView.mm +++ b/AsyncDisplayKit/ASTableView.mm @@ -910,11 +910,11 @@ static BOOL _isInterceptedSelector(SEL sel) #pragma mark - ASCellNodeLayoutDelegate -- (void)nodeDidRelayoutWithSizeChange:(ASCellNode *)node +- (void)nodeDidRelayout:(ASCellNode *)node sizeChanged:(BOOL)sizeChanged { ASDisplayNodeAssertMainThread(); - if (_queuedNodeHeightUpdate) { + if (!sizeChanged || _queuedNodeHeightUpdate) { return; }