Bug 1457249 - Use actually calculated value for the assertion that checks animation value is unchanged when we decided to skip calculation for the animation on debug build. r=kats

Before this change, the value which was set by SetShadowBaseTransform()
has been used for the assertion, but it is possible that the value is changed
by APZ.  And it's hard to tell whether the value has been changed by APZ or not
and it's hard to *reverse-calculate* the differences in the past APZ at the
moment we want to do the assert.

So after this patch, on debug build we don't actually skip the calculation for
unchanged animations and use the newly calculated value for the assertion.

MozReview-Commit-ID: 8fCcvvbUMHe

--HG--
extra : rebase_source : 0ff5e7100ad33a690bb0edd02af2b00c749afbbe
This commit is contained in:
Hiroyuki Ikezoe 2018-04-28 18:09:27 +09:00
Родитель 83df03fa3f
Коммит 41be7768d1
2 изменённых файлов: 35 добавлений и 2 удалений

Просмотреть файл

@ -156,6 +156,14 @@ AnimationHelper::SampleAnimationForEachNode(
MOZ_ASSERT(!aAnimations.IsEmpty(), "Should be called with animations");
bool hasInEffectAnimations = false;
#ifdef DEBUG
// In cases where this function returns a SampleResult::Skipped, we actually
// do populate aAnimationValue in debug mode, so that we can MOZ_ASSERT at the
// call site that the value that would have been computed matches the stored
// value that we end up using. This flag is used to ensure we populate
// aAnimationValue in this scenario.
bool shouldBeSkipped = false;
#endif
// Process in order, since later aAnimations override earlier ones.
for (size_t i = 0, iEnd = aAnimations.Length(); i < iEnd; ++i) {
Animation& animation = aAnimations[i];
@ -204,7 +212,11 @@ AnimationHelper::SampleAnimationForEachNode(
iterCompositeOperation,
animData.mProgressOnLastCompose,
animData.mCurrentIterationOnLastCompose)) {
#ifdef DEBUG
shouldBeSkipped = true;
#else
return SampleResult::Skipped;
#endif
}
uint32_t segmentIndex = 0;
@ -236,7 +248,11 @@ AnimationHelper::SampleAnimationForEachNode(
animData.mSegmentIndexOnLastCompose == segmentIndex &&
!animData.mPortionInSegmentOnLastCompose.IsNull() &&
animData.mPortionInSegmentOnLastCompose.Value() == portion) {
#ifdef DEBUG
shouldBeSkipped = true;
#else
return SampleResult::Skipped;
#endif
}
AnimationPropertySegment animSegment;
@ -260,6 +276,13 @@ AnimationHelper::SampleAnimationForEachNode(
iterCompositeOperation,
portion,
computedTiming.mCurrentIteration).Consume();
#ifdef DEBUG
if (shouldBeSkipped) {
return SampleResult::Skipped;
}
#endif
hasInEffectAnimations = true;
animData.mProgressOnLastCompose = computedTiming.mProgress;
animData.mCurrentIterationOnLastCompose = computedTiming.mCurrentIteration;

Просмотреть файл

@ -713,17 +713,27 @@ SampleAnimations(Layer* aLayer,
MOZ_ASSERT(
layer->AsHostLayer()->GetShadowOpacitySetByAnimation());
MOZ_ASSERT(FuzzyEqualsMultiplicative(
layer->AsHostLayer()->GetShadowOpacity(),
Servo_AnimationValue_GetOpacity(animationValue),
*(aStorage->GetAnimationOpacity(layer->GetCompositorAnimationsId()))));
break;
case eCSSProperty_transform: {
MOZ_ASSERT(
layer->AsHostLayer()->GetShadowTransformSetByAnimation());
AnimatedValue* transform =
aStorage->GetAnimatedValue(layer->GetCompositorAnimationsId());
const TransformData& transformData =
animations[0].data().get_TransformData();
Matrix4x4 frameTransform =
ServoAnimationValueToMatrix4x4(animationValue, transformData);
Matrix4x4 transformInDevice =
FrameTransformToTransformInDevice(frameTransform,
layer,
transformData);
MOZ_ASSERT(
transform->mTransform.mTransformInDevSpace.FuzzyEqualsMultiplicative(
(layer->AsHostLayer()->GetShadowBaseTransform())));
transformInDevice));
break;
}
default: