Skip to content

Commit

Permalink
Clean up timing of layout tree flattening/ copying of unflattened tre…
Browse files Browse the repository at this point in the history
…e for Weaver (TextureGroup#1157)

* Simpler Huy fix for more efficient delayed flattening of the layout tree

* Nit

* Remove pbx changes

* Update CHANGELOG.md

* Add note about change in timing of _flattenedLayout capture
  • Loading branch information
mikezucc committed Nov 7, 2018
1 parent 584dae2 commit 6cc666b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
- Optimize layout process by removing `ASRectMap`. [Adlai Holler](https://github.com/Adlai-Holler)
- Remove necessity to use view to access rangeController in ASTableNode, ASCollectionNode. [Michael Schneider](https://github.com/maicki)
- Remove display node's reliance on shared_ptr. [Adlai Holler](https://github.com/Adlai-Holler)
- Clean up timing of layout tree flattening/ copying of unflattened tree for Weaver. [Michael Zuccarino](https://github.com/mikezucc) [#1157](https://github.com/TextureGroup/Texture/pull/1157)

## 2.7
- Fix pager node for interface coalescing. [Max Wang](https://github.com/wsdwsd0829) [#877](https://github.com/TextureGroup/Texture/pull/877)
Expand Down
12 changes: 0 additions & 12 deletions Source/ASDisplayNode+Layout.mm
Original file line number Diff line number Diff line change
Expand Up @@ -993,12 +993,6 @@ - (void)_pendingLayoutTransitionDidComplete
_pendingLayoutTransition = nil;
}

- (void)_setCalculatedDisplayNodeLayout:(const ASDisplayNodeLayout &)displayNodeLayout
{
ASDN::MutexLocker l(__instanceLock__);
[self _locked_setCalculatedDisplayNodeLayout:displayNodeLayout];
}

- (void)_locked_setCalculatedDisplayNodeLayout:(const ASDisplayNodeLayout &)displayNodeLayout
{
ASAssertLocked(__instanceLock__);
Expand All @@ -1007,12 +1001,6 @@ - (void)_locked_setCalculatedDisplayNodeLayout:(const ASDisplayNodeLayout &)disp
ASDisplayNodeAssertTrue(displayNodeLayout.layout.size.height >= 0.0);

_calculatedDisplayNodeLayout = displayNodeLayout;

// Flatten the layout if it wasn't done before (@see -calculateLayoutThatFits:).
if ([ASDisplayNode shouldStoreUnflattenedLayouts]) {
_unflattenedLayout = _calculatedDisplayNodeLayout.layout;
_calculatedDisplayNodeLayout.layout = [_unflattenedLayout filteredNodeLayoutTree];
}
}

@end
8 changes: 4 additions & 4 deletions Source/ASDisplayNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1220,11 +1220,11 @@ - (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize
}
ASDisplayNodeLogEvent(self, @"computedLayout: %@", layout);

// Return the (original) unflattened layout if it needs to be stored. The layout will be flattened later on (@see _locked_setCalculatedDisplayNodeLayout:).
// Otherwise, flatten it right away.
if (! [ASDisplayNode shouldStoreUnflattenedLayouts]) {
layout = [layout filteredNodeLayoutTree];
// PR #1157: Reduces accuracy of _unflattenedLayout for debugging/Weaver
if ([ASDisplayNode shouldStoreUnflattenedLayouts]) {
_unflattenedLayout = layout;
}
layout = [layout filteredNodeLayoutTree];

return layout;
}
Expand Down

0 comments on commit 6cc666b

Please sign in to comment.