From 29609bfe87d0953c203b508bfe4ed945d0815356 Mon Sep 17 00:00:00 2001 From: Levi McCallum Date: Fri, 29 Jan 2016 10:51:46 -0800 Subject: [PATCH] Clean up long lines --- AsyncDisplayKit/ASDisplayNode.mm | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/AsyncDisplayKit/ASDisplayNode.mm b/AsyncDisplayKit/ASDisplayNode.mm index b554995181..a3a572f570 100644 --- a/AsyncDisplayKit/ASDisplayNode.mm +++ b/AsyncDisplayKit/ASDisplayNode.mm @@ -622,16 +622,11 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c) ASDisplayNodeAssertTrue(_layout.size.width >= 0.0); ASDisplayNodeAssertTrue(_layout.size.height >= 0.0); - // we generate placeholders at measureWithSizeRange: time so that a node is guaranteed to have a placeholder ready to go - // also if a node has no size, it should not have a placeholder - if (self.placeholderEnabled && [self _displaysAsynchronously] && _layout.size.width > 0.0 && _layout.size.height > 0.0) { - if (!_placeholderImage) { - _placeholderImage = [self placeholderImage]; - } - - if (_placeholderLayer) { - [self setupPlaceholderLayerContents]; - } + // we generate placeholders at measureWithSizeRange: time so that a node is guaranteed + // to have a placeholder ready to go. Also, if a node has no size it should not have a placeholder + if (self.placeholderEnabled && [self _displaysAsynchronously] && + _layout.size.width > 0.0 && _layout.size.height > 0.0) { + [self __generatePlaceholder]; } return _layout; @@ -639,6 +634,18 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c) - (void)calculatedLayoutDidChange { + // subclass override +} + +- (void)__generatePlaceholder +{ + if (!_placeholderImage) { + _placeholderImage = [self placeholderImage]; + } + + if (_placeholderLayer) { + [self setupPlaceholderLayerContents]; + } } - (BOOL)displaysAsynchronously @@ -819,7 +826,10 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c) ASDisplayNodeAssertMainThread(); ASDN::MutexLocker l(_propertyLock); if (CGRectEqualToRect(self.bounds, CGRectZero)) { - return; // Performing layout on a zero-bounds view often results in frame calculations with negative sizes after applying margins, which will cause measureWithSizeRange: on subnodes to assert. + // Performing layout on a zero-bounds view often results in frame calculations + // with negative sizes after applying margins, which will cause + // measureWithSizeRange: on subnodes to assert. + return; } _placeholderLayer.frame = self.bounds; [self layout];