diff --git a/AsyncDisplayKit/TextKit/ASTextKitRenderer.mm b/AsyncDisplayKit/TextKit/ASTextKitRenderer.mm index b7e333e86b..d4246b2a1c 100755 --- a/AsyncDisplayKit/TextKit/ASTextKitRenderer.mm +++ b/AsyncDisplayKit/TextKit/ASTextKitRenderer.mm @@ -205,12 +205,15 @@ static NSCharacterSet *_defaultAvoidTruncationCharacterSet() - (BOOL)canUseFastPath { - return self.isScaled == NO - && self.usesCustomTruncation == NO - && self.usesExclusionPaths == NO - // NSAttributedString drawing methods ignore usesLineFragmentOrigin if max line count 1, - // rendering them useless: - && (_attributes.maximumNumberOfLines != 1 || isinf(_constrainedSize.width)); + return NO; +// Fast path is temporarily disabled, because it's crashing in production. +// NOTE: Remember to re-enable testFastPathTruncation when we re-enable this. +// return self.isScaled == NO +// && self.usesCustomTruncation == NO +// && self.usesExclusionPaths == NO +// // NSAttributedString drawing methods ignore usesLineFragmentOrigin if max line count 1, +// // rendering them useless: +// && (_attributes.maximumNumberOfLines != 1 || isinf(_constrainedSize.width)); } #pragma mark - Drawing diff --git a/AsyncDisplayKitTests/ASTextNodeSnapshotTests.m b/AsyncDisplayKitTests/ASTextNodeSnapshotTests.m index a819ba2f22..1dac0c198c 100644 --- a/AsyncDisplayKitTests/ASTextNodeSnapshotTests.m +++ b/AsyncDisplayKitTests/ASTextNodeSnapshotTests.m @@ -75,7 +75,8 @@ ASSnapshotVerifyView(backgroundView, nil); } -- (void)testThatFastPathTruncationWorks +// This test is disabled because the fast-path is disabled. +- (void)DISABLED_testThatFastPathTruncationWorks { ASTextNode *textNode = [[ASTextNode alloc] init]; textNode.attributedText = [[NSAttributedString alloc] initWithString:@"Quality is Important" attributes:@{ NSForegroundColorAttributeName: [UIColor blueColor], NSFontAttributeName: [UIFont italicSystemFontOfSize:24] }]; @@ -87,8 +88,9 @@ { ASTextNode *textNode = [[ASTextNode alloc] init]; textNode.attributedText = [[NSAttributedString alloc] initWithString:@"Quality is Important" attributes:@{ NSForegroundColorAttributeName: [UIColor blueColor], NSFontAttributeName: [UIFont italicSystemFontOfSize:24] }]; - [textNode layoutThatFits:ASSizeRangeMake(CGSizeZero, CGSizeMake(100, 50))]; + // Set exclusion paths to trigger slow path textNode.exclusionPaths = @[ [UIBezierPath bezierPath] ]; + [textNode layoutThatFits:ASSizeRangeMake(CGSizeZero, CGSizeMake(100, 50))]; ASSnapshotVerifyNode(textNode, nil); } diff --git a/AsyncDisplayKitTests/ReferenceImages_64/ASTextNodeSnapshotTests/testThatSlowPathTruncationWorks@2x.png b/AsyncDisplayKitTests/ReferenceImages_64/ASTextNodeSnapshotTests/testThatSlowPathTruncationWorks@2x.png index dcae003909..4d68f59813 100644 Binary files a/AsyncDisplayKitTests/ReferenceImages_64/ASTextNodeSnapshotTests/testThatSlowPathTruncationWorks@2x.png and b/AsyncDisplayKitTests/ReferenceImages_64/ASTextNodeSnapshotTests/testThatSlowPathTruncationWorks@2x.png differ diff --git a/AsyncDisplayKitTests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testThatSlowPathTruncationWorks@2x.png b/AsyncDisplayKitTests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testThatSlowPathTruncationWorks@2x.png index bf816c2ed4..18de8b27fe 100644 Binary files a/AsyncDisplayKitTests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testThatSlowPathTruncationWorks@2x.png and b/AsyncDisplayKitTests/ReferenceImages_iOS_10/ASTextNodeSnapshotTests/testThatSlowPathTruncationWorks@2x.png differ