diff --git a/AsyncDisplayKit/ASControlNode.h b/AsyncDisplayKit/ASControlNode.h index 886855f008..9f5c37e343 100644 --- a/AsyncDisplayKit/ASControlNode.h +++ b/AsyncDisplayKit/ASControlNode.h @@ -120,11 +120,6 @@ typedef NS_OPTIONS(NSUInteger, ASControlState) { */ - (void)sendActionsForControlEvents:(ASControlNodeEvent)controlEvents withEvent:(nullable UIEvent *)event; -/** - Class method to enable a visualization overlay of the tapable area on the ASControlNode. For app debugging purposes only. - @param enable Specify YES to make this debug feature enabled when messaging the ASControlNode class. - */ -+ (void)setEnableHitTestDebug:(BOOL)enable; @end NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/ASDisplayNode.mm b/AsyncDisplayKit/ASDisplayNode.mm index c9615282ea..d16479a5d5 100644 --- a/AsyncDisplayKit/ASDisplayNode.mm +++ b/AsyncDisplayKit/ASDisplayNode.mm @@ -2003,6 +2003,8 @@ void recursivelyTriggerDisplayForLayer(CALayer *layer, BOOL shouldBlock) - (void)setInterfaceState:(ASInterfaceState)newState { + // It should never be possible for a node to be visible but not be allowed / expected to display. + ASDisplayNodeAssertFalse(ASInterfaceStateIncludesVisible(newState) && !ASInterfaceStateIncludesDisplay(newState)); ASInterfaceState oldState = ASInterfaceStateNone; { ASDN::MutexLocker l(_propertyLock); diff --git a/AsyncDisplayKit/AsyncDisplayKit+Debug.h b/AsyncDisplayKit/AsyncDisplayKit+Debug.h index c9be26f11a..4192d67398 100644 --- a/AsyncDisplayKit/AsyncDisplayKit+Debug.h +++ b/AsyncDisplayKit/AsyncDisplayKit+Debug.h @@ -6,9 +6,19 @@ // Copyright © 2016 Facebook. All rights reserved. // -#import +#import "ASControlNode.h" #import "ASImageNode.h" +@interface ASControlNode (Debugging) + +/** + Class method to enable a visualization overlay of the tapable area on the ASControlNode. For app debugging purposes only. + @param enable Specify YES to make this debug feature enabled when messaging the ASControlNode class. + */ ++ (void)setEnableHitTestDebug:(BOOL)enable; + +@end + @interface ASImageNode (Debugging) /** @@ -20,4 +30,4 @@ + (void)setShouldShowImageScalingOverlay:(BOOL)show; + (BOOL)shouldShowImageScalingOverlay; -@end \ No newline at end of file +@end diff --git a/AsyncDisplayKit/Details/ASRangeController.mm b/AsyncDisplayKit/Details/ASRangeController.mm index 22ad82e426..d89d117af4 100644 --- a/AsyncDisplayKit/Details/ASRangeController.mm +++ b/AsyncDisplayKit/Details/ASRangeController.mm @@ -238,6 +238,7 @@ static UIApplicationState __ApplicationState = UIApplicationStateActive; [self registerForNotificationsForInterfaceStateIfNeeded:selfInterfaceState]; #if ASRangeControllerLoggingEnabled + ASDisplayNodeAssertTrue([visibleIndexPaths isSubsetOfSet:displayIndexPaths]); NSMutableArray *modifiedIndexPaths = (ASRangeControllerLoggingEnabled ? [NSMutableArray array] : nil); #endif @@ -247,14 +248,15 @@ static UIApplicationState __ApplicationState = UIApplicationStateActive; ASInterfaceState interfaceState = ASInterfaceStateMeasureLayout; if (ASInterfaceStateIncludesVisible(selfInterfaceState)) { - if ([fetchDataIndexPaths containsObject:indexPath]) { - interfaceState |= ASInterfaceStateFetchData; - } - if ([displayIndexPaths containsObject:indexPath]) { - interfaceState |= ASInterfaceStateDisplay; - } if ([visibleIndexPaths containsObject:indexPath]) { - interfaceState |= ASInterfaceStateVisible; + interfaceState |= (ASInterfaceStateVisible | ASInterfaceStateDisplay | ASInterfaceStateFetchData); + } else { + if ([fetchDataIndexPaths containsObject:indexPath]) { + interfaceState |= ASInterfaceStateFetchData; + } + if ([displayIndexPaths containsObject:indexPath]) { + interfaceState |= ASInterfaceStateDisplay; + } } } else { // If selfInterfaceState isn't visible, then visibleIndexPaths represents what /will/ be immediately visible at the