bool KeyframeEffectReadOnly::ShouldBlockAsyncTransformAnimations( const nsIFrame* aFrame, AnimationPerformanceWarning::Type& aPerformanceWarning) const { // We currently only expect this method to be called for effects whose // animations are eligible for the compositor since, Animations that are // paused, zero-duration, finished etc. should not block other animations from // running on the compositor. MOZ_ASSERT(mAnimation && mAnimation->IsPlayableOnCompositor()); EffectSet* effectSet = EffectSet::GetEffectSet(mTarget->mElement, mTarget->mPseudoType); for (const AnimationProperty& property : mProperties) { // If there is a property for animations level that is overridden by // !important rules, it should not block other animations from running // on the compositor. // NOTE: We don't currently check for !important rules for properties that // don't run on the compositor. As result such properties (e.g. margin-left) // can still block async animations even if they are overridden by // !important rules. if (effectSet && effectSet->PropertiesWithImportantRules() .HasProperty(property.mProperty) && effectSet->PropertiesForAnimationsLevel() .HasProperty(property.mProperty)) { continue; } // Check for geometric properties if (IsGeometricProperty(property.mProperty)) { aPerformanceWarning = AnimationPerformanceWarning::Type::TransformWithGeometricProperties; return true; } // Check for unsupported transform animations if (property.mProperty == eCSSProperty_transform) { if (!CanAnimateTransformOnCompositor(aFrame, aPerformanceWarning)) { return true; } } } return false; }
bool KeyframeEffectReadOnly::ShouldBlockAsyncTransformAnimations( const nsIFrame* aFrame, AnimationPerformanceWarning::Type& aPerformanceWarning) const { // We currently only expect this method to be called when this effect // is attached to a playing Animation. If that ever changes we'll need // to update this to only return true when that is the case since paused, // filling, cancelled Animations etc. shouldn't stop other Animations from // running on the compositor. MOZ_ASSERT(mAnimation && mAnimation->IsPlaying()); for (const AnimationProperty& property : mProperties) { // If a property is overridden in the CSS cascade, it should not block other // animations from running on the compositor. if (!property.mWinsInCascade) { continue; } // Check for geometric properties if (IsGeometricProperty(property.mProperty)) { aPerformanceWarning = AnimationPerformanceWarning::Type::TransformWithGeometricProperties; return true; } // Check for unsupported transform animations if (property.mProperty == eCSSProperty_transform) { if (!CanAnimateTransformOnCompositor(aFrame, aPerformanceWarning)) { return true; } } } return false; }