diff --git a/dom/animation/test/chrome/test_restyles.html b/dom/animation/test/chrome/test_restyles.html index 8279b197904b..df168b357ec9 100644 --- a/dom/animation/test/chrome/test_restyles.html +++ b/dom/animation/test/chrome/test_restyles.html @@ -66,10 +66,11 @@ SimpleTest.waitForExplicitFinish(); var omtaEnabled = isOMTAEnabled(); var isAndroid = !!navigator.userAgent.includes("Android"); +var isServo = isStyledByServo(); var offscreenThrottlingEnabled = SpecialPowers.getBoolPref('dom.animations.offscreen-throttling') && - !isStyledByServo(); // Bug 1303235 : For stylo we don't yet accumulate change - // hints which are used for offscreen throttling. + !isServo; // Bug 1303235 : For stylo we don't yet accumulate change + // hints which are used for offscreen throttling. function add_task_if_omta_enabled(test) { if (!omtaEnabled) { @@ -760,11 +761,28 @@ waitForAllPaints(function() { document.body.appendChild(div); markers = await observeStyling(1); - // Bug 1388557: We should call RequestRestyle(Layer) when an element which - // has running script animations is attached to a document. - todo_is(markers.length, 1, - 'Bug 1388557 We should observe one restyle in the first frame ' + - 'right after re-attaching to the document'); + if (isServo) { + // In Servo, we explicitly set important_rules_change flag to the element + // in compute_style() during the initial normal traversal right after + // re-attaching which leads to invoking a SequentialTask for + // CascadeResults which ends up calling RequestRestyle(Standard). As a + // result, the animation is restyled during a second animation restyle in + // the first frame. If we fix the behavior when we attach an orphaned + // element with script animations to a document so that it requests a + // layer restyle (bug 1388557) before fixing important_rules_change in + // compute_style() so that it no longer dispatches a needless standard + // restyle (bug 1388560), we should add a test case that fails if we + // continue to unnecessarily request a standard restyle. + is(markers.length, 1, + 'We should observe one restyle in the first frame right after ' + + 're-attaching to the document'); + } else { + // Bug 1388557: We should call RequestRestyle(Layer) when an element which + // has running script animations is attached to a document. + todo_is(markers.length, 1, + 'Bug 1388557 We should observe one restyle in the first frame ' + + 'right after re-attaching to the document'); + } markers = await observeStyling(5); is(markers.length, 5, 'Animation on re-attached to the document begins to update style');