зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1418059 - Stop eagerly CSS animations on the root of display:none subtree. r=birtles
Otherwise we do update keyframes data unnecessarily. MozReview-Commit-ID: ys4BEF1kxX --HG-- extra : rebase_source : 725aef9a4be9296bc992f6128be7c62b4c2b01e1
This commit is contained in:
Родитель
264402226f
Коммит
49f31bb414
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<style>
|
||||
@keyframes anim {
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
.document-ready .animation::after {
|
||||
display: none;
|
||||
}
|
||||
.animation::after {
|
||||
content: "";
|
||||
animation: anim 1s infinite;
|
||||
}
|
||||
</style>
|
||||
<div class="animation"></div>
|
||||
<script>
|
||||
window.addEventListener('load', () => {
|
||||
document.documentElement.classList.add('document-ready');
|
||||
requestAnimationFrame(() => {
|
||||
document.documentElement.classList.remove('reftest-wait');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</html>
|
|
@ -263,3 +263,4 @@ load 1413361.html
|
|||
load 1415663.html
|
||||
pref(dom.webcomponents.enabled,true) load 1415353.html
|
||||
load 1415021.html # This should have dom.webcomponents.enabled=true, but it leaks the world, see bug 1416296.
|
||||
load 1418059.html
|
||||
|
|
|
@ -1068,10 +1068,17 @@ nsAnimationManager::UpdateAnimations(
|
|||
"Should not update animations that are not attached to the "
|
||||
"document tree");
|
||||
|
||||
if (!aStyleContext) {
|
||||
const nsStyleDisplay* disp = aStyleContext
|
||||
? aStyleContext->ComputedData()->GetStyleDisplay()
|
||||
: nullptr;
|
||||
|
||||
if (!disp || disp->mDisplay == StyleDisplay::None) {
|
||||
// If we are in a display:none subtree we will have no computed values.
|
||||
// Since CSS animations should not run in display:none subtrees we should
|
||||
// stop (actually, destroy) any animations on this element here.
|
||||
// However, if we are on the root of display:none subtree, the computed
|
||||
// values might not have been cleared yet.
|
||||
// In either case, since CSS animations should not run in display:none
|
||||
// subtrees we should stop (actually, destroy) any animations on this
|
||||
// element here.
|
||||
StopAnimationsForElement(aElement, aPseudoType);
|
||||
return;
|
||||
}
|
||||
|
@ -1079,8 +1086,6 @@ nsAnimationManager::UpdateAnimations(
|
|||
NonOwningAnimationTarget target(aElement, aPseudoType);
|
||||
ServoCSSAnimationBuilder builder(aStyleContext);
|
||||
|
||||
const nsStyleDisplay *disp =
|
||||
aStyleContext->ComputedData()->GetStyleDisplay();
|
||||
DoUpdateAnimations(target, *disp, builder);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче