From caddd1d287740a474de474e3807cbcba19e2f5c5 Mon Sep 17 00:00:00 2001 From: Huy Nguyen Date: Thu, 3 Mar 2016 16:18:07 -0800 Subject: [PATCH] Fix threadSafeBounds - Bounds change set directly to _ASDisplayLayer should also be saved to threadSafeBounds - Remove overkill _usesDisplayView flag --- AsyncDisplayKit/ASDisplayNode.mm | 2 -- AsyncDisplayKit/Details/_ASDisplayLayer.mm | 6 ++++++ AsyncDisplayKit/Private/ASDisplayNode+UIViewBridge.mm | 6 ++---- AsyncDisplayKit/Private/ASDisplayNodeInternal.h | 1 - 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/AsyncDisplayKit/ASDisplayNode.mm b/AsyncDisplayKit/ASDisplayNode.mm index 9cc28bcffb..9168806b76 100644 --- a/AsyncDisplayKit/ASDisplayNode.mm +++ b/AsyncDisplayKit/ASDisplayNode.mm @@ -429,13 +429,11 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c) ASDisplayNodeAssert(![view isKindOfClass:[_ASDisplayView class]], @"View block should return a synchronously displayed view"); _viewBlock = nil; _viewClass = [view class]; - _usesDisplayView = NO; } else { if (!_viewClass) { _viewClass = [self.class viewClass]; } view = [[_viewClass alloc] init]; - _usesDisplayView = [_viewClass isKindOfClass:[_ASDisplayView class]]; } return view; diff --git a/AsyncDisplayKit/Details/_ASDisplayLayer.mm b/AsyncDisplayKit/Details/_ASDisplayLayer.mm index fd1b9b1fcb..9b5246f587 100644 --- a/AsyncDisplayKit/Details/_ASDisplayLayer.mm +++ b/AsyncDisplayKit/Details/_ASDisplayLayer.mm @@ -78,6 +78,12 @@ } } +- (void)setBounds:(CGRect)bounds +{ + [super setBounds:bounds]; + self.asyncdisplaykit_node.threadSafeBounds = bounds; +} + #if DEBUG // These override is strictly to help detect application-level threading errors. Avoid method overhead in release. - (void)setContents:(id)contents { diff --git a/AsyncDisplayKit/Private/ASDisplayNode+UIViewBridge.mm b/AsyncDisplayKit/Private/ASDisplayNode+UIViewBridge.mm index aed7bfb495..68876415a7 100644 --- a/AsyncDisplayKit/Private/ASDisplayNode+UIViewBridge.mm +++ b/AsyncDisplayKit/Private/ASDisplayNode+UIViewBridge.mm @@ -18,6 +18,7 @@ #import "ASEqualityHelpers.h" #import "ASPendingStateController.h" #import "ASThread.h" +#import "ASTextNode.h" /** * The following macros are conveniences to help in the common tasks related to the bridging that ASDisplayNode does to UIView and CALayer. @@ -211,10 +212,7 @@ if (shouldApply) { _layer.layerProperty = (layerValueExpr); } else { ASDisplayNo { _bridge_prologue_write; _setToViewOrLayer(bounds, newBounds, bounds, newBounds); - // If _ASDisplayView is available, it already sets the new bounds to threadSafeBounds. - if (! (__loaded(self) && _usesDisplayView)) { - self.threadSafeBounds = newBounds; - } + self.threadSafeBounds = newBounds; } - (CGRect)frame diff --git a/AsyncDisplayKit/Private/ASDisplayNodeInternal.h b/AsyncDisplayKit/Private/ASDisplayNodeInternal.h index d3a10724a9..c63b89582b 100644 --- a/AsyncDisplayKit/Private/ASDisplayNodeInternal.h +++ b/AsyncDisplayKit/Private/ASDisplayNodeInternal.h @@ -117,7 +117,6 @@ FOUNDATION_EXPORT NSString * const ASRenderingEngineDidDisplayNodesScheduledBefo ASDisplayNodeDidLoadBlock _nodeLoadedBlock; Class _viewClass; Class _layerClass; - BOOL _usesDisplayView; UIImage *_placeholderImage; CALayer *_placeholderLayer;