Bug 1676791 - Part 7: Disable OMTA for scroll-timeline. r=hiro

For simplicity purposes, we don't consider OMTA for now. OMTA support
for scoll-timeline will be done in Bug 1737180.

However, in this patch, we would like to address:
if the geometic animations use scroll-timeline, we don't have to let it
affect the transform animations on the same animation target:
1. If we don't do scrolling, its geometric properties don't change, so no
   effect on transform-like properties.
2. If we do scrolling, we may un-throttle the transform animations by
   other ways, e.g. Keyframe::CanThrottle(). So we don't need to worry
   about this.

Note: tests are in the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D129103
This commit is contained in:
Boris Chiou 2021-12-08 01:16:30 +00:00
Родитель 61b1cac7bb
Коммит b47eaf7ccc
3 изменённых файлов: 23 добавлений и 1 удалений

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

@ -1035,6 +1035,8 @@ bool Animation::ShouldBeSynchronizedWithMainThread(
// We check this before calling ShouldBlockAsyncTransformAnimations, partly
// because it's cheaper, but also because it's often the most useful thing
// to know when you're debugging performance.
// Note: |mSyncWithGeometricAnimations| wouldn't be set if the geometric
// animations use scroll-timeline.
if (StaticPrefs::
dom_animations_mainthread_synchronization_with_geometric_animations() &&
mSyncWithGeometricAnimations &&

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

@ -1687,9 +1687,13 @@ bool KeyframeEffect::ShouldBlockAsyncTransformAnimations(
return true;
}
MOZ_ASSERT(mAnimation);
// Note: If the geometric animations are using scroll-timeline, we don't need
// to synchronize transform animations with them.
const bool enableMainthreadSynchronizationWithGeometricAnimations =
StaticPrefs::
dom_animations_mainthread_synchronization_with_geometric_animations();
dom_animations_mainthread_synchronization_with_geometric_animations() &&
!mAnimation->UsingScrollTimeline();
for (const AnimationProperty& property : mProperties) {
// If there is a property for animations level that is overridden by
@ -2025,6 +2029,13 @@ KeyframeEffect::MatchForCompositor KeyframeEffect::IsMatchForCompositor(
return KeyframeEffect::MatchForCompositor::NoAndBlockThisProperty;
}
// Unconditionally disable OMTA for scroll-timeline.
// FIXME: Bug 1737180: Once we support OMTA for scroll-timeline, we can just
// drop this.
if (mAnimation->UsingScrollTimeline()) {
return KeyframeEffect::MatchForCompositor::No;
}
if (!HasEffectiveAnimationOfPropertySet(aPropertySet, aEffects)) {
return KeyframeEffect::MatchForCompositor::No;
}

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

@ -142,6 +142,15 @@ void PendingAnimationTracker::MarkAnimationsThatMightNeedSynchronization() {
mHasPlayPendingGeometricAnimations = CheckState::Absent;
for (const auto& animation : mPlayPendingSet) {
if (animation->GetEffect() && animation->GetEffect()->AffectsGeometry()) {
if (animation->UsingScrollTimeline()) {
// Skip the animation if it is using scroll-timeline. Its geometric
// animations shouldn't affect others (because the animation ticks
// based on the scrolling or the frame size changes).
// If we don't do scrolling, its geometry doesn't change, so no effect.
// If we do scrolling, we may un-throttle the transform animations by
// other ways. (See Keyframe::CanThrottle() for more info in this case.)
continue;
}
mHasPlayPendingGeometricAnimations &= ~CheckState::Absent;
mHasPlayPendingGeometricAnimations |= IsTransition(*animation)
? CheckState::TransitionsPresent