Don't copy container during ASTextNode2 layout (#1115)

This commit is contained in:
Adlai Holler
2018-09-13 11:06:12 -07:00
committed by GitHub
parent 1d2f1f2ed8
commit eb5bd0942b
2 changed files with 3 additions and 9 deletions

View File

@@ -39,6 +39,7 @@
- Renamed `accessibleElements` to `accessibilityElements` and removed the re-definition of the property in ASDisplayView. [Jia Wern Lim](https://github.com/jiawernlim)
- Remove double scaling of lineHeightMultiple & paragraphSpacing attributes in ASTextKitFontSizeAdjuster. [Eric Jensen](https://github.com/ejensen)
- Add a delegate callback for when the framework has initialized. [Adlai Holler](https://github.com/Adlai-Holler)
- Improve TextNode2 by skipping an unneeded copy during measurement. [Adlai Holler](https://github.com/Adlai-Holler)
## 2.7
- Fix pager node for interface coalescing. [Max Wang](https://github.com/wsdwsd0829) [#877](https://github.com/TextureGroup/Texture/pull/877)

View File

@@ -232,19 +232,12 @@ static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ];
ASLockScopeSelf();
ASTextContainer *container;
if (!CGSizeEqualToSize(container.size, constrainedSize)) {
container = [_textContainer copy];
container.size = constrainedSize;
[container makeImmutable];
} else {
container = _textContainer;
}
_textContainer.size = constrainedSize;
[self _ensureTruncationText];
NSMutableAttributedString *mutableText = [_attributedText mutableCopy];
[self prepareAttributedString:mutableText];
ASTextLayout *layout = [ASTextNode2 compatibleLayoutWithContainer:container text:mutableText];
ASTextLayout *layout = [ASTextNode2 compatibleLayoutWithContainer:_textContainer text:mutableText];
return layout.textBoundingSize;
}