Skip to content

Commit

Permalink
Don't copy container during ASTextNode2 layout (TextureGroup#1115)
Browse files Browse the repository at this point in the history
  • Loading branch information
Adlai-Holler authored and mikezucc committed Oct 2, 2018
1 parent c8b22e4 commit b06844b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 2 additions & 9 deletions Source/ASTextNode2.mm
Original file line number Diff line number Diff line change
Expand Up @@ -232,19 +232,12 @@ - (CGSize)calculateSizeThatFits:(CGSize)constrainedSize

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;
}
Expand Down

0 comments on commit b06844b

Please sign in to comment.