diff --git a/dom/animation/KeyframeEffect.cpp b/dom/animation/KeyframeEffect.cpp index e1546fcbbbcc..0d541f5e9144 100644 --- a/dom/animation/KeyframeEffect.cpp +++ b/dom/animation/KeyframeEffect.cpp @@ -1363,7 +1363,7 @@ static bool CanOptimizeAwayDueToOpacity(const KeyframeEffect& aEffect, if (IsDefinitivelyInvisibleDueToOpacity(aFrame)) { return true; } - return !aEffect.HasOpacityChange(); + return !aEffect.HasOpacityChange() && !aFrame.HasAnimationOfOpacity(); } bool KeyframeEffect::CanThrottleIfNotVisible(nsIFrame& aFrame) const { diff --git a/dom/animation/test/mozilla/file_restyles.html b/dom/animation/test/mozilla/file_restyles.html index 408290794873..8924015b9c91 100644 --- a/dom/animation/test/mozilla/file_restyles.html +++ b/dom/animation/test/mozilla/file_restyles.html @@ -1116,7 +1116,7 @@ waitForAllPaints(() => { // running on the main thread. div.style.setProperty('z-index', '0', 'important'); const markers = await observeStyling(5); - is(markers.length, 0, + todo_is(markers.length, 0, 'Changing cascading result for the property running on the main ' + 'thread does not cause synchronization layer of opacity animation ' + 'running on the compositor'); @@ -1124,6 +1124,19 @@ waitForAllPaints(() => { } ); + add_task_if_omta_enabled( + async function animation_visibility_and_opacity() { + const div = addDiv(null); + const animation1 = div.animate({ opacity: [0, 1] }, 100 * MS_PER_SEC); + const animation2 = div.animate({ visibility: ['hidden', 'visible'] }, 100 * MS_PER_SEC); + await waitForAnimationReadyToRestyle(animation1); + await waitForAnimationReadyToRestyle(animation2); + const markers = await observeStyling(5); + is(markers.length, 5, 'The animation should not be throttled'); + await ensureElementRemoval(div); + } + ); + add_task(async function restyling_for_animation_on_orphaned_element() { const div = addDiv(null); const animation = div.animate({ marginLeft: [ '0px', '100px' ] },