@@ -165,8 +165,7 @@ static void calculateShadowViewMutationsFlattener(
165
165
Tag parentTagForUpdate,
166
166
TinyMap<Tag, ShadowViewNodePair*>* parentSubVisitedOtherNewNodes,
167
167
TinyMap<Tag, ShadowViewNodePair*>* parentSubVisitedOtherOldNodes,
168
- const CullingContext& oldCullingContext,
169
- const CullingContext& newCullingContext);
168
+ const CullingContext& cullingContext);
170
169
171
170
/* *
172
171
* Updates the subtrees of any matched ShadowViewNodePair. This handles
@@ -222,8 +221,7 @@ static void updateMatchedPairSubtrees(
222
221
oldPair.shadowView .tag ,
223
222
nullptr ,
224
223
nullptr ,
225
- oldCullingContextCopy,
226
- newCullingContextCopy);
224
+ oldCullingContextCopy);
227
225
}
228
226
// Unflattening
229
227
else {
@@ -257,7 +255,6 @@ static void updateMatchedPairSubtrees(
257
255
parentTag,
258
256
nullptr ,
259
257
nullptr ,
260
- oldCullingContextCopy,
261
258
newCullingContextCopy);
262
259
263
260
// If old nodes were not visited, we know that we can delete
@@ -423,12 +420,11 @@ static void calculateShadowViewMutationsFlattener(
423
420
Tag parentTagForUpdate,
424
421
TinyMap<Tag, ShadowViewNodePair*>* parentSubVisitedOtherNewNodes,
425
422
TinyMap<Tag, ShadowViewNodePair*>* parentSubVisitedOtherOldNodes,
426
- const CullingContext& oldCullingContext,
427
- const CullingContext& newCullingContext) {
423
+ const CullingContext& cullingContext) {
428
424
// Step 1: iterate through entire tree
429
425
std::vector<ShadowViewNodePair*> treeChildren =
430
426
sliceChildShadowNodeViewPairsFromViewNodePair (
431
- node, scope, false , newCullingContext );
427
+ node, scope, false , cullingContext );
432
428
433
429
DEBUG_LOGS ({
434
430
LOG (ERROR) << " Differ Flattener: "
@@ -620,16 +616,13 @@ static void calculateShadowViewMutationsFlattener(
620
616
}
621
617
622
618
auto adjustedOldCullingContext =
623
- oldCullingContext .adjustCullingContextIfNeeded (oldTreeNodePair);
619
+ cullingContext .adjustCullingContextIfNeeded (oldTreeNodePair);
624
620
auto adjustedNewCullingContext =
625
- newCullingContext .adjustCullingContextIfNeeded (newTreeNodePair);
621
+ cullingContext .adjustCullingContextIfNeeded (newTreeNodePair);
626
622
627
623
// Update children if appropriate.
628
624
if (!oldTreeNodePair.flattened && !newTreeNodePair.flattened ) {
629
- if (oldTreeNodePair.shadowNode != newTreeNodePair.shadowNode ||
630
- oldCullingContext != newCullingContext) {
631
- // TODO(T217775046): Find a test case for oldCullingContext !=
632
- // newCullingContext condition above.
625
+ if (oldTreeNodePair.shadowNode != newTreeNodePair.shadowNode ) {
633
626
ViewNodePairScope innerScope{};
634
627
auto oldGrandChildPairs =
635
628
sliceChildShadowNodeViewPairsFromViewNodePair (
@@ -677,12 +670,9 @@ static void calculateShadowViewMutationsFlattener(
677
670
: parentTag),
678
671
subVisitedNewMap,
679
672
subVisitedOldMap,
680
- oldCullingContext,
681
- newCullingContext);
673
+ cullingContext.adjustCullingContextIfNeeded (treeChildPair));
682
674
} else {
683
675
// Get flattened nodes from either new or old tree
684
- // TODO(T217775046): Find a test case for this branch of view
685
- // flattening + culling.
686
676
auto flattenedNodes = sliceChildShadowNodeViewPairsFromViewNodePair (
687
677
(childReparentMode == ReparentMode::Flatten ? newTreeNodePair
688
678
: oldTreeNodePair),
@@ -735,8 +725,7 @@ static void calculateShadowViewMutationsFlattener(
735
725
: parentTagForUpdateWhenUnflattened),
736
726
subVisitedNewMap,
737
727
subVisitedOldMap,
738
- adjustedOldCullingContext,
739
- adjustedNewCullingContext);
728
+ cullingContext.adjustCullingContextIfNeeded (oldTreeNodePair));
740
729
}
741
730
// Flatten parent, unflatten child
742
731
else {
@@ -762,8 +751,9 @@ static void calculateShadowViewMutationsFlattener(
762
751
: parentTag),
763
752
/* parentSubVisitedOtherNewNodes */ subVisitedNewMap,
764
753
/* parentSubVisitedOtherOldNodes */ subVisitedOldMap,
765
- oldCullingContext,
766
- newCullingContext);
754
+ reparentMode == ReparentMode::Flatten
755
+ ? adjustedOldCullingContext
756
+ : adjustedNewCullingContext);
767
757
768
758
// If old nodes were not visited, we know that we can delete them
769
759
// now. They will be removed from the hierarchy by the outermost
@@ -848,10 +838,8 @@ static void calculateShadowViewMutationsFlattener(
848
838
continue ;
849
839
}
850
840
851
- auto adjustedOldCullingContext =
852
- oldCullingContext.adjustCullingContextIfNeeded (treeChildPair);
853
- auto adjustedNewCullingContext =
854
- newCullingContext.adjustCullingContextIfNeeded (treeChildPair);
841
+ auto adjustedCullingContext =
842
+ cullingContext.adjustCullingContextIfNeeded (treeChildPair);
855
843
856
844
if (reparentMode == ReparentMode::Flatten) {
857
845
mutationContainer.deleteMutations .push_back (
@@ -864,10 +852,10 @@ static void calculateShadowViewMutationsFlattener(
864
852
mutationContainer.destructiveDownwardMutations ,
865
853
treeChildPair.shadowView .tag ,
866
854
sliceChildShadowNodeViewPairsFromViewNodePair (
867
- treeChildPair, innerScope, false , adjustedOldCullingContext ),
855
+ treeChildPair, innerScope, false , adjustedCullingContext ),
868
856
{},
869
- adjustedOldCullingContext ,
870
- newCullingContext );
857
+ adjustedCullingContext ,
858
+ {} );
871
859
}
872
860
} else {
873
861
mutationContainer.createMutations .push_back (
@@ -881,9 +869,9 @@ static void calculateShadowViewMutationsFlattener(
881
869
treeChildPair.shadowView .tag ,
882
870
{},
883
871
sliceChildShadowNodeViewPairsFromViewNodePair (
884
- treeChildPair, innerScope, false , adjustedNewCullingContext ),
885
- oldCullingContext ,
886
- adjustedNewCullingContext );
872
+ treeChildPair, innerScope, false , adjustedCullingContext ),
873
+ {} ,
874
+ adjustedCullingContext );
887
875
}
888
876
}
889
877
}
0 commit comments