Deprecate shouldRasterizeDescendants (#3024)

* Deprecate shouldRasterizeDescendants

* Set superclass right
This commit is contained in:
Adlai Holler 2017-02-13 13:34:53 -08:00 committed by GitHub
parent fe0bcec98f
commit bbc1aecf95
13 changed files with 31 additions and 41 deletions

View File

@ -24,7 +24,7 @@
058D09CA195D04C000B7D73C /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 058D09C8195D04C000B7D73C /* InfoPlist.strings */; };
058D0A38195D057000B7D73C /* ASDisplayLayerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 058D0A2D195D057000B7D73C /* ASDisplayLayerTests.m */; };
058D0A39195D057000B7D73C /* ASDisplayNodeAppearanceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 058D0A2E195D057000B7D73C /* ASDisplayNodeAppearanceTests.m */; };
058D0A3A195D057000B7D73C /* ASDisplayNodeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 058D0A2F195D057000B7D73C /* ASDisplayNodeTests.m */; };
058D0A3A195D057000B7D73C /* ASDisplayNodeTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 058D0A2F195D057000B7D73C /* ASDisplayNodeTests.mm */; };
058D0A3B195D057000B7D73C /* ASDisplayNodeTestsHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 058D0A31195D057000B7D73C /* ASDisplayNodeTestsHelper.m */; };
058D0A3C195D057000B7D73C /* ASMutableAttributedStringBuilderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 058D0A32195D057000B7D73C /* ASMutableAttributedStringBuilderTests.m */; };
058D0A3D195D057000B7D73C /* ASTextKitCoreTextAdditionsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 058D0A33195D057000B7D73C /* ASTextKitCoreTextAdditionsTests.m */; };
@ -460,7 +460,7 @@
058D0A12195D050800B7D73C /* ASThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASThread.h; sourceTree = "<group>"; };
058D0A2D195D057000B7D73C /* ASDisplayLayerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = ASDisplayLayerTests.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
058D0A2E195D057000B7D73C /* ASDisplayNodeAppearanceTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = ASDisplayNodeAppearanceTests.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
058D0A2F195D057000B7D73C /* ASDisplayNodeTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASDisplayNodeTests.m; sourceTree = "<group>"; };
058D0A2F195D057000B7D73C /* ASDisplayNodeTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASDisplayNodeTests.mm; sourceTree = "<group>"; };
058D0A30195D057000B7D73C /* ASDisplayNodeTestsHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASDisplayNodeTestsHelper.h; sourceTree = "<group>"; };
058D0A31195D057000B7D73C /* ASDisplayNodeTestsHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASDisplayNodeTestsHelper.m; sourceTree = "<group>"; };
058D0A32195D057000B7D73C /* ASMutableAttributedStringBuilderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASMutableAttributedStringBuilderTests.m; sourceTree = "<group>"; };
@ -991,7 +991,7 @@
ACF6ED541B178DC700DA7C62 /* ASDimensionTests.mm */,
058D0A2D195D057000B7D73C /* ASDisplayLayerTests.m */,
058D0A2E195D057000B7D73C /* ASDisplayNodeAppearanceTests.m */,
058D0A2F195D057000B7D73C /* ASDisplayNodeTests.m */,
058D0A2F195D057000B7D73C /* ASDisplayNodeTests.mm */,
69B225661D72535E00B25B22 /* ASDisplayNodeLayoutTests.mm */,
058D0A30195D057000B7D73C /* ASDisplayNodeTestsHelper.h */,
058D0A31195D057000B7D73C /* ASDisplayNodeTestsHelper.m */,
@ -1746,8 +1746,8 @@
058D0A39195D057000B7D73C /* ASDisplayNodeAppearanceTests.m in Sources */,
CCB2F34D1D63CCC6004E6DE9 /* ASDisplayNodeSnapshotTests.m in Sources */,
AE6987C11DD04E1000B9E458 /* ASPagerNodeTests.m in Sources */,
058D0A3A195D057000B7D73C /* ASDisplayNodeTests.m in Sources */,
699B83511E3C1BA500433FA4 /* ASLayoutSpecTests.m in Sources */,
058D0A3A195D057000B7D73C /* ASDisplayNodeTests.mm in Sources */,
696FCB311D6E46050093471E /* ASBackgroundLayoutSpecSnapshotTests.mm in Sources */,
69FEE53D1D95A9AF0086F066 /* ASLayoutElementStyleTests.m in Sources */,
CC4981B31D1A02BE004E13CC /* ASTableViewThrashTests.m in Sources */,

View File

@ -148,7 +148,7 @@ typedef struct {
* Note: this has nothing to do with -[CALayer shouldRasterize], which doesn't work with ASDisplayNode's asynchronous
* rendering model.
*/
@property (nonatomic, assign) BOOL shouldRasterizeDescendants;
@property (nonatomic, assign) BOOL shouldRasterizeDescendants ASDISPLAYNODE_DEPRECATED_MSG("Deprecated in version 2.2");
@end

View File

@ -14,6 +14,7 @@
#import <AsyncDisplayKit/ASDisplayNodeExtras.h>
#import <AsyncDisplayKit/ASDisplayNode+FrameworkPrivate.h>
#import <AsyncDisplayKit/ASDisplayNode+Beta.h>
#import <AsyncDisplayKit/ASDisplayNodeInternal.h>
#pragma mark - UIAccessibilityElement

View File

@ -283,6 +283,12 @@ FOUNDATION_EXPORT NSString * const ASRenderingEngineDidDisplayNodesScheduledBefo
*/
- (ASPrimitiveTraitCollection)primitiveTraitCollection;
/**
* This is a non-deprecated internal declaration of the property. Public declaration
* is in ASDisplayNode+Beta.h
*/
@property (nonatomic, assign) BOOL shouldRasterizeDescendants;
@end
NS_ASSUME_NONNULL_END

View File

@ -18,6 +18,7 @@
#import <AsyncDisplayKit/ASDisplayNode+Subclasses.h>
#import <AsyncDisplayKit/ASDisplayNode+FrameworkPrivate.h>
#import <AsyncDisplayKit/ASDisplayNode+Deprecated.h>
#import <AsyncDisplayKit/ASDisplayNodeInternal.h>
#import "ASDisplayNodeTestsHelper.h"
#import <AsyncDisplayKit/UIView+ASConvenience.h>
#import <AsyncDisplayKit/ASCellNode.h>

View File

@ -15,7 +15,11 @@
typedef BOOL (^as_condition_block_t)(void);
ASDISPLAYNODE_EXTERN_C_BEGIN
BOOL ASDisplayNodeRunRunLoopUntilBlockIsTrue(as_condition_block_t block);
void ASDisplayNodeSizeToFitSize(ASDisplayNode *node, CGSize size);
void ASDisplayNodeSizeToFitSizeRange(ASDisplayNode *node, ASSizeRange sizeRange);
ASDISPLAYNODE_EXTERN_C_END

View File

@ -19,12 +19,6 @@ NSOrderedSet *ASSnapshotTestCaseDefaultSuffixes(void);
{ \
[ASSnapshotTestCase hackilySynchronouslyRecursivelyRenderNode:node__]; \
FBSnapshotVerifyLayerWithOptions(node__.layer, identifier__, ASSnapshotTestCaseDefaultSuffixes(), 0) \
[node__ setShouldRasterizeDescendants:YES]; \
[ASSnapshotTestCase hackilySynchronouslyRecursivelyRenderNode:node__]; \
FBSnapshotVerifyLayerWithOptions(node__.layer, identifier__, ASSnapshotTestCaseDefaultSuffixes(), 0) \
[node__ setShouldRasterizeDescendants:NO]; \
[ASSnapshotTestCase hackilySynchronouslyRecursivelyRenderNode:node__]; \
FBSnapshotVerifyLayerWithOptions(node__.layer, identifier__, ASSnapshotTestCaseDefaultSuffixes(), 0) \
}
#define ASSnapshotVerifyLayer(layer__, identifier__) \

View File

@ -20,7 +20,7 @@
#import <AsyncDisplayKit/AsyncDisplayKit.h>
#import "CommentFeedModel.h"
@interface CommentsNode : ASTextCellNode
@interface CommentsNode : ASDisplayNode
- (void)updateWithCommentFeedModel:(CommentFeedModel *)feed;

View File

@ -100,7 +100,7 @@
_photoCommentsNode = [[CommentsNode alloc] init];
_photoCommentsNode.shouldRasterizeDescendants = YES;
_photoCommentsNode.layerBacked = YES;
// instead of adding everything addSubnode:
self.automaticallyManagesSubnodes = YES;

View File

@ -50,6 +50,8 @@
if (self) {
_post = post;
self.selectionStyle = UITableViewCellSelectionStyleNone;
// Name node
_nameNode = [[ASTextNode alloc] init];
_nameNode.attributedText = [[NSAttributedString alloc] initWithString:_post.name attributes:[TextStyles nameStyle]];
@ -180,6 +182,10 @@
_optionsNode = [[ASImageNode alloc] init];
_optionsNode.image = [UIImage imageNamed:@"icon_more"];
[self addSubnode:_optionsNode];
for (ASDisplayNode *node in self.subnodes) {
node.layerBacked = YES;
}
}
return self;
}

View File

@ -149,18 +149,4 @@
return self.socialAppDataSource.count;
}
- (void)tableNode:(ASTableNode *)tableNode didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
PostNode *postNode = (PostNode *)[_tableNode nodeForRowAtIndexPath:indexPath];
Post *post = self.socialAppDataSource[indexPath.row];
BOOL shouldRasterize = postNode.shouldRasterizeDescendants;
shouldRasterize = !shouldRasterize;
postNode.shouldRasterizeDescendants = shouldRasterize;
NSLog(@"%@ rasterization for %@'s post: %@", shouldRasterize ? @"Enabling" : @"Disabling", post.name, postNode);
[tableNode deselectRowAtIndexPath:indexPath animated:YES];
}
@end

View File

@ -50,6 +50,8 @@
if (self) {
_post = post;
self.selectionStyle = UITableViewCellSelectionStyleNone;
// Name node
_nameNode = [[ASTextNode alloc] init];
_nameNode.attributedText = [[NSAttributedString alloc] initWithString:_post.name attributes:[TextStyles nameStyle]];
@ -180,6 +182,10 @@
_optionsNode = [[ASImageNode alloc] init];
_optionsNode.image = [UIImage imageNamed:@"icon_more"];
[self addSubnode:_optionsNode];
for (ASDisplayNode *node in self.subnodes) {
node.layerBacked = YES;
}
}
return self;
}

View File

@ -133,18 +133,4 @@
return self.socialAppDataSource.count;
}
- (void)tableNode:(ASTableNode *)tableNode didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
PostNode *postNode = (PostNode *)[_tableNode nodeForRowAtIndexPath:indexPath];
Post *post = self.socialAppDataSource[indexPath.row];
BOOL shouldRasterize = postNode.shouldRasterizeDescendants;
shouldRasterize = !shouldRasterize;
postNode.shouldRasterizeDescendants = shouldRasterize;
NSLog(@"%@ rasterization for %@'s post: %@", shouldRasterize ? @"Enabling" : @"Disabling", post.name, postNode);
[tableNode deselectRowAtIndexPath:indexPath animated:YES];
}
@end