Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ void LayoutAnimationDriver::animationMutationsForFrame(
}
}

// Record boundary: animation-frame Updates above this point carry
// parentTag from before any structural changes and must execute first.
auto animationUpdatesEnd = mutationsList.size();

// Clear out finished animations
for (auto it = inflightAnimations_.begin();
it != inflightAnimations_.end();) {
Expand All @@ -99,10 +103,11 @@ void LayoutAnimationDriver::animationMutationsForFrame(
}
}

// Final step: make sure that all operations execute in the proper order.
// REMOVE operations with highest indices must operate first.
// Sort only the final mutations from completed animations.
// Animation-frame Updates must stay before structural mutations because
// they reference views by their pre-structural-change parentTag.
std::stable_sort(
mutationsList.begin(),
mutationsList.begin() + static_cast<ptrdiff_t>(animationUpdatesEnd),
mutationsList.end(),
&shouldFirstComeBeforeSecondMutation);
}
Expand Down
Loading