Bug 1388557 - Call RequestRestyle(Layer) in the case where we attach orphaned animating element to the document. r=birtles

MozReview-Commit-ID: IIcyYFROqDx

--HG--
extra : rebase_source : f096635d400528660d5243d2884d125e7b623db2
This commit is contained in:
Hiroyuki Ikezoe 2018-02-21 10:13:13 +09:00
parent 4606fafb88
commit 467ed67c74
2 changed files with 18 additions and 12 deletions

View File

@ -1288,21 +1288,14 @@ waitForAllPaints(() => {
// 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.
// the first frame.
todo_is(markers.length, 1,
'Bug 1388560 We should observe one restyle in the first frame ' +
'right after re-attaching to the document');
} else {
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,

View File

@ -1849,6 +1849,19 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
}
MOZ_ASSERT(parent);
}
if (MayHaveAnimations() &&
(pseudoType == CSSPseudoElementType::NotPseudo ||
pseudoType == CSSPseudoElementType::before ||
pseudoType == CSSPseudoElementType::after) &&
EffectSet::GetEffectSet(this, pseudoType)) {
if (nsPresContext* presContext = aDocument->GetPresContext()) {
presContext->EffectCompositor()->
RequestRestyle(this, pseudoType,
EffectCompositor::RestyleType::Standard,
EffectCompositor::CascadeLevel::Animations);
}
}
}
// XXXbz script execution during binding can trigger some of these