Bug 1479173 - Check animation generation change in the mProperties loop and drop LayerAnimationInfo::sRecords loop. r=birtles

If mIsRunningOnCompositor is true, the property is effective state because
CanThrottle() is called in advance of a restyle for the effect so that we can
drop the check and drop skipping in the case of non-effective properties.

Depends on D10694

Differential Revision: https://phabricator.services.mozilla.com/D10695
This commit is contained in:
Hiroyuki Ikezoe
2018-11-06 09:40:39 +00:00
parent f96020fefa
commit 4592f89e0e
3 changed files with 37 additions and 13 deletions

View File

@@ -1242,23 +1242,18 @@ KeyframeEffect::CanThrottle() const
return true;
}
EffectSet* effectSet = nullptr;
for (const AnimationProperty& property : mProperties) {
if (!property.mIsRunningOnCompositor) {
return false;
}
}
EffectSet* effectSet = nullptr;
for (const LayerAnimationInfo::Record& record :
LayerAnimationInfo::sRecords) {
// Skip properties that are overridden by !important rules.
// (GetEffectiveAnimationOfProperty, as called by
// HasEffectiveAnimationOfProperty, only returns a property which is
// neither overridden by !important rules nor overridden by other
// animation.)
if (!HasEffectiveAnimationOfProperty(record.mProperty)) {
continue;
}
MOZ_ASSERT(nsCSSPropertyIDSet::CompositorAnimatables()
.HasProperty(property.mProperty),
"The property should be able to run on the compositor");
MOZ_ASSERT(HasEffectiveAnimationOfProperty(property.mProperty),
"There should be an effective animation of the property while "
"it is marked as being run on the compositor");
if (!effectSet) {
effectSet = EffectSet::GetEffectSet(mTarget->mElement,
@@ -1266,10 +1261,14 @@ KeyframeEffect::CanThrottle() const
MOZ_ASSERT(effectSet, "CanThrottle should be called on an effect "
"associated with a target element");
}
DisplayItemType displayItemType =
LayerAnimationInfo::GetDisplayItemTypeForProperty(property.mProperty);
// Note that AnimationInfo::GetGenarationFromFrame() is supposed to work
// with the primary frame instead of the style frame.
Maybe<uint64_t> generation = layers::AnimationInfo::GetGenerationFromFrame(
GetPrimaryFrame(), record.mDisplayItemType);
GetPrimaryFrame(), displayItemType);
// Unthrottle if the animation needs to be brought up to date
if (!generation || effectSet->GetAnimationGeneration() != *generation) {
return false;