mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
[ASTextNode] Go Back to Having Renderer as Ivar (#2376)
* Revert "Disable ASTextKitRenderer cache (#2315)"
This reverts commit 4aa7c9631d.
* Revert "[ASTextNode] Add NSCache based cache for ASTextKitRenderer (#2199)"
This commit is contained in:
@@ -116,6 +116,31 @@ static NSCharacterSet *_defaultAvoidTruncationCharacterSet()
|
||||
return _calculatedSize;
|
||||
}
|
||||
|
||||
- (void)setConstrainedSize:(CGSize)constrainedSize
|
||||
{
|
||||
if (!CGSizeEqualToSize(constrainedSize, _constrainedSize)) {
|
||||
_sizeIsCalculated = NO;
|
||||
_constrainedSize = constrainedSize;
|
||||
_calculatedSize = CGSizeZero;
|
||||
|
||||
// Throw away the all subcomponents to create them with the new constrained size new as well as let the
|
||||
// truncater do it's job again for the new constrained size. This is necessary as after a truncation did happen
|
||||
// the context would use the truncated string and not the original string to truncate based on the new
|
||||
// constrained size
|
||||
__block ASTextKitContext *ctx = _context;
|
||||
__block ASTextKitTailTruncater *tru = _truncater;
|
||||
__block ASTextKitFontSizeAdjuster *adj = _fontSizeAdjuster;
|
||||
_context = nil;
|
||||
_truncater = nil;
|
||||
_fontSizeAdjuster = nil;
|
||||
ASPerformBlockOnDeallocationQueue(^{
|
||||
ctx = nil;
|
||||
tru = nil;
|
||||
adj = nil;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_calculateSize
|
||||
{
|
||||
// if we have no scale factors or an unconstrained width, there is no reason to try to adjust the font size
|
||||
|
||||
Reference in New Issue
Block a user