LayoutAnimations: assert that tag >0 instead of != 0

Summary:
LayoutAnimations: assert that tag >0 instead of != 0. It's possible that a corrupt tag value would be below zero which is not valid.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26271515

fbshipit-source-id: a62445ad29d60e5180e62ec4c6d5b08784655808
This commit is contained in:
Joshua Gross
2021-02-05 00:57:42 -08:00
committed by Facebook GitHub Bot
parent 1c2a95d6c6
commit 95cab24a6e
2 changed files with 20 additions and 20 deletions
@@ -79,8 +79,8 @@ void LayoutAnimationDriver::animationMutationsForFrame(
// All generated Update mutations must have an "old" and "new"
// ShadowView. Checking for nonzero tag doesn't guarantee that the views
// are valid/correct, just that something is there.
assert(updateMutation.oldChildShadowView.tag != 0);
assert(updateMutation.newChildShadowView.tag != 0);
assert(updateMutation.oldChildShadowView.tag > 0);
assert(updateMutation.newChildShadowView.tag > 0);
mutationsList.push_back(updateMutation);
PrintMutationInstruction("Animation Progress:", updateMutation);
@@ -125,9 +125,9 @@ void LayoutAnimationDriver::animationMutationsForFrame(
keyframe.viewPrev,
finalMutationForKeyFrame.newChildShadowView,
finalMutationForKeyFrame.index};
assert(mutation.oldChildShadowView.tag != 0);
assert(mutation.oldChildShadowView.tag > 0);
assert(
mutation.newChildShadowView.tag != 0 ||
mutation.newChildShadowView.tag > 0 ||
finalMutationForKeyFrame.type == ShadowViewMutation::Remove ||
finalMutationForKeyFrame.type == ShadowViewMutation::Delete);
mutationsList.push_back(mutation);
@@ -142,8 +142,8 @@ void LayoutAnimationDriver::animationMutationsForFrame(
keyframe.viewPrev,
keyframe.viewEnd,
-1};
assert(mutation.oldChildShadowView.tag != 0);
assert(mutation.newChildShadowView.tag != 0);
assert(mutation.oldChildShadowView.tag > 0);
assert(mutation.newChildShadowView.tag > 0);
mutationsList.push_back(mutation);
}
}
@@ -1143,7 +1143,7 @@ LayoutAnimationKeyFrameManager::pullTransaction(
// already made in the current animation, and start the animation
// from this point.
keyFrame.viewStart = conflictingKeyFrame.viewPrev;
assert(keyFrame.viewStart.tag != 0);
assert(keyFrame.viewStart.tag > 0);
keyFrame.initialProgress = 0;
// We're guaranteed that a tag only has one animation associated
@@ -1154,9 +1154,9 @@ LayoutAnimationKeyFrameManager::pullTransaction(
}
}
assert(keyFrame.viewStart.tag != 0);
assert(keyFrame.viewEnd.tag != 0);
assert(keyFrame.viewPrev.tag != 0);
assert(keyFrame.viewStart.tag > 0);
assert(keyFrame.viewEnd.tag > 0);
assert(keyFrame.viewPrev.tag > 0);
keyFramesToAnimate.push_back(keyFrame);
}
@@ -1245,9 +1245,9 @@ LayoutAnimationKeyFrameManager::pullTransaction(
PrintMutationInstruction(
"Queueing up final mutation instruction - update:",
mutationInstruction);
assert(mutationInstruction.oldChildShadowView.tag != 0);
assert(mutationInstruction.oldChildShadowView.tag > 0);
assert(
mutationInstruction.newChildShadowView.tag != 0 ||
mutationInstruction.newChildShadowView.tag > 0 ||
mutationInstruction.type == ShadowViewMutation::Delete ||
mutationInstruction.type == ShadowViewMutation::Remove);
finalConflictingMutations.push_back(mutationInstruction);
@@ -1268,8 +1268,8 @@ LayoutAnimationKeyFrameManager::pullTransaction(
auto generatedPenultimateMutation =
ShadowViewMutation::UpdateMutation(
keyFrame.viewPrev, mutatedShadowView);
assert(generatedPenultimateMutation.oldChildShadowView.tag != 0);
assert(generatedPenultimateMutation.newChildShadowView.tag != 0);
assert(generatedPenultimateMutation.oldChildShadowView.tag > 0);
assert(generatedPenultimateMutation.newChildShadowView.tag > 0);
PrintMutationInstruction(
"Queueing up penultimate mutation instruction - synthetic",
generatedPenultimateMutation);
@@ -1277,8 +1277,8 @@ LayoutAnimationKeyFrameManager::pullTransaction(
auto generatedMutation = ShadowViewMutation::UpdateMutation(
mutatedShadowView, keyFrame.viewEnd);
assert(generatedMutation.oldChildShadowView.tag != 0);
assert(generatedMutation.newChildShadowView.tag != 0);
assert(generatedMutation.oldChildShadowView.tag > 0);
assert(generatedMutation.newChildShadowView.tag > 0);
PrintMutationInstruction(
"Queueing up final mutation instruction - synthetic",
generatedMutation);
@@ -1451,8 +1451,8 @@ LayoutAnimationKeyFrameManager::pullTransaction(
auto generatedPenultimateMutation =
ShadowViewMutation::UpdateMutation(
keyFrame.viewPrev, mutatedShadowView);
assert(generatedPenultimateMutation.oldChildShadowView.tag != 0);
assert(generatedPenultimateMutation.newChildShadowView.tag != 0);
assert(generatedPenultimateMutation.oldChildShadowView.tag > 0);
assert(generatedPenultimateMutation.newChildShadowView.tag > 0);
PrintMutationInstruction(
"No Animation: Queueing up penultimate mutation instruction - synthetic",
generatedPenultimateMutation);
@@ -1461,8 +1461,8 @@ LayoutAnimationKeyFrameManager::pullTransaction(
auto generatedMutation = ShadowViewMutation::UpdateMutation(
mutatedShadowView, keyFrame.viewEnd);
assert(generatedMutation.oldChildShadowView.tag != 0);
assert(generatedMutation.newChildShadowView.tag != 0);
assert(generatedMutation.oldChildShadowView.tag > 0);
assert(generatedMutation.newChildShadowView.tag > 0);
PrintMutationInstruction(
"No Animation: Queueing up final mutation instruction - synthetic",
generatedMutation);