diff --git a/AsyncDisplayKit/ASDisplayNode.mm b/AsyncDisplayKit/ASDisplayNode.mm index 47683a8bb4..710b5b61e7 100644 --- a/AsyncDisplayKit/ASDisplayNode.mm +++ b/AsyncDisplayKit/ASDisplayNode.mm @@ -742,20 +742,6 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c) [self displayImmediately]; } -- (void)__setNeedsDisplay -{ - ASDN::MutexLocker l(_propertyLock); - //NSLog(@"About to find parent rasterize for %@", self); - ASDisplayNode *rasterizedContainerNode = [self __rasterizedContainerNode]; - if (rasterizedContainerNode) { - [rasterizedContainerNode setNeedsDisplay]; - } else { - if (_layer && !self.isSynchronous && self.displaysAsynchronously) { - [ASDisplayNode scheduleNodeForDisplay:self]; - } - } -} - - (void)__setNeedsLayout { ASDisplayNodeAssertThreadAffinity(self); diff --git a/AsyncDisplayKit/Private/ASDisplayNode+UIViewBridge.mm b/AsyncDisplayKit/Private/ASDisplayNode+UIViewBridge.mm index 9fa3258997..a34d1fd1ec 100644 --- a/AsyncDisplayKit/Private/ASDisplayNode+UIViewBridge.mm +++ b/AsyncDisplayKit/Private/ASDisplayNode+UIViewBridge.mm @@ -240,7 +240,17 @@ [rasterizedContainerNode setNeedsDisplay]; }); } else { + // If not rasterized (and therefore we certainly have a view or layer), + // Send the message to the view/layer first, as scheduleNodeForDisplay may call -displayIfNeeded. + // Wrapped / synchronous nodes created with initWithView/LayerBlock: do not need scheduleNodeForDisplay, + // as they don't need to display in the working range at all - since at all times onscreen, one + // -setNeedsDisplay to the CALayer will result in a synchronous display in the next frame. + _messageToViewOrLayer(setNeedsDisplay); + if (_layer && !self.isSynchronous) { + [ASDisplayNode scheduleNodeForDisplay:self]; + } + } } diff --git a/AsyncDisplayKit/Private/ASDisplayNodeInternal.h b/AsyncDisplayKit/Private/ASDisplayNodeInternal.h index f30361a3ab..830c400dfb 100644 --- a/AsyncDisplayKit/Private/ASDisplayNodeInternal.h +++ b/AsyncDisplayKit/Private/ASDisplayNodeInternal.h @@ -108,6 +108,8 @@ typedef NS_OPTIONS(NSUInteger, ASDisplayNodeMethodOverrides) } ++ (void)scheduleNodeForDisplay:(ASDisplayNode *)node; + // The _ASDisplayLayer backing the node, if any. @property (nonatomic, readonly, retain) _ASDisplayLayer *asyncLayer;