Bug 1419851 - Part2. Handle OMTA throttle for webrender. r=kats,birtles
MozReview-Commit-ID: 4YgqLUdE4R
--- a/dom/animation/KeyframeEffectReadOnly.cpp
+++ b/dom/animation/KeyframeEffectReadOnly.cpp
@@ -1446,24 +1446,28 @@ KeyframeEffectReadOnly::CanThrottle() co
if (!HasEffectiveAnimationOfProperty(record.mProperty)) {
continue;
}
EffectSet* effectSet = EffectSet::GetEffectSet(mTarget->mElement,
mTarget->mPseudoType);
MOZ_ASSERT(effectSet, "CanThrottle should be called on an effect "
"associated with a target element");
- layers::Layer* layer =
- FrameLayerBuilder::GetDedicatedLayer(frame, record.mLayerType);
- // Unthrottle if the layer needs to be brought up to date
- if (!layer ||
+ layers::AnimationInfo* animationInfo =
+ layers::AnimationInfo::GetFromFrame(frame,
+ record.mLayerType,
+ GetPresShell());
+ // Unthrottle if the animation needs to be brought up to date
+ if (!animationInfo ||
effectSet->GetAnimationGeneration() !=
- layer->GetAnimationGeneration()) {
+ animationInfo->GetAnimationGeneration()) {
return false;
}
+ // Set the animationInfo to nullptr to prevent wrong using of the pointer.
+ animationInfo = nullptr;
// If this is a transform animation that affects the overflow region,
// we should unthrottle the animation periodically.
if (record.mProperty == eCSSProperty_transform &&
!CanThrottleTransformChanges(*frame)) {
return false;
}
}