diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bb364617..3701bce94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/Source/ASDisplayNode+Layout.mm b/Source/ASDisplayNode+Layout.mm index fe1df8fc6..866f66187 100644 --- a/Source/ASDisplayNode+Layout.mm +++ b/Source/ASDisplayNode+Layout.mm @@ -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__); @@ -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 diff --git a/Source/ASDisplayNode.mm b/Source/ASDisplayNode.mm index deddfe4a2..d9d6a66b5 100644 --- a/Source/ASDisplayNode.mm +++ b/Source/ASDisplayNode.mm @@ -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; }