Bug 1416966 - Count a remaining animation restyle request when animating element was detached from the document. r?birtles
If element which has script animations is detached between Animation::Tick and
styling process, the element persists in EffectCompositor::mElementsToRestyle
(
bug 1417354). When the element is attached to the document again, the element
in mElementsToRestyle is considered as a target element that needs to be
traversed in the first animation-only restyling. Thus the remaining restyle
request can be observed with the new micro task checkpoint for animations.
MozReview-Commit-ID: F6gs2QXcZ8X
--- a/dom/animation/test/mozilla/file_restyles.html
+++ b/dom/animation/test/mozilla/file_restyles.html
@@ -878,19 +878,23 @@ waitForAllPaints(() => {
// 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');
+ //
+ // Bug 1417354: There will be an additional superfluos restyle request
+ // whichi results when we detach an element from the document between
+ // the Animation tick and styling, and then re-attach it.
+ todo_is(markers.length, 2,
+ '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);