scott's comments

This commit is contained in:
rcancro 2016-01-28 15:18:45 -08:00
parent 7f6f2fed11
commit 715a678829

View File

@ -102,7 +102,7 @@ static NSString *ASTextNodeTruncationTokenAttributeName = @"ASTextNodeTruncation
UILongPressGestureRecognizer *_longPressGestureRecognizer; UILongPressGestureRecognizer *_longPressGestureRecognizer;
// Forwards NSLayoutManagerDelegate methods related to word kerning ASDN::Mutex _wordKernerLock;
ASTextNodeWordKerner *_wordKerner; ASTextNodeWordKerner *_wordKerner;
} }
@ -148,8 +148,6 @@ static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ];
// on the special placeholder behavior of ASTextNode. // on the special placeholder behavior of ASTextNode.
_placeholderColor = ASDisplayNodeDefaultPlaceholderColor(); _placeholderColor = ASDisplayNodeDefaultPlaceholderColor();
_placeholderInsets = UIEdgeInsetsMake(1.0, 0.0, 1.0, 0.0); _placeholderInsets = UIEdgeInsetsMake(1.0, 0.0, 1.0, 0.0);
_wordKerner = [[ASTextNodeWordKerner alloc] init];
} }
return self; return self;
@ -264,7 +262,7 @@ static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ];
.maximumNumberOfLines = _maximumNumberOfLines, .maximumNumberOfLines = _maximumNumberOfLines,
.exclusionPaths = _exclusionPaths, .exclusionPaths = _exclusionPaths,
.minimumScaleFactor = _minimumScaleFactor, .minimumScaleFactor = _minimumScaleFactor,
.layoutManagerDelegate = _wordKerner, .layoutManagerDelegate = [self _wordKerner],
}; };
} }
@ -300,6 +298,15 @@ static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ];
} }
} }
- (ASTextNodeWordKerner *)_wordKerner
{
ASDN::MutexLocker l(_wordKernerLock);
if (_wordKerner == nil) {
_wordKerner = [[ASTextNodeWordKerner alloc] init];
}
return _wordKerner;
}
#pragma mark - Layout and Sizing #pragma mark - Layout and Sizing
- (BOOL)_needInvalidateRendererForBoundsSize:(CGSize)boundsSize - (BOOL)_needInvalidateRendererForBoundsSize:(CGSize)boundsSize