Bug 1164813 - Make nsAnimationManager update cached in-effect status even when there is no frame; r=dbaron

This commit is contained in:
Brian Birtles 2015-05-22 13:46:26 +09:00
parent 0c6a724062
commit 2dee8a57ea
3 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,33 @@
<!doctype html>
<html class="reftest-wait">
<style>
#parent.hidden {
display: none;
}
.icon {
opacity: 0;
transition: opacity 0.5s;
}
.icon.shrink {
animation: shrink 1s;
}
@keyframes shrink {
to { transform: scale(0); }
}
</style>
<div id="parent">
<div class="icon">Searching</div>
</div>
<script>
var icon = document.querySelector('.icon');
getComputedStyle(icon).opacity;
icon.style.opacity = 1;
icon.classList.add('shrink');
setTimeout(function() {
document.getElementById('parent').classList.add('hidden');
setTimeout(function() {
document.documentElement.removeAttribute('class');
}, 500);
}, 500);
</script>
</html>

View File

@ -117,5 +117,6 @@ load 1161320-1.html
pref(dom.animations-api.core.enabled,true) load 1161320-2.html
load 1161366-1.html
load 1163446-1.html
load 1164813-1.html
load large_border_image_width.html
load border-image-visited-link.html

View File

@ -246,13 +246,25 @@ nsAnimationManager::MaybeUpdateCascadeResults(AnimationCollection* aCollection)
if (anim->IsInEffect() != anim->mInEffectForCascadeResults) {
// Update our own cascade results.
mozilla::dom::Element* element = aCollection->GetElementToRestyle();
bool updatedCascadeResults = false;
if (element) {
nsIFrame* frame = element->GetPrimaryFrame();
if (frame) {
UpdateCascadeResults(frame->StyleContext(), aCollection);
updatedCascadeResults = true;
}
}
if (!updatedCascadeResults) {
// If we don't have a style context we can't do the work of updating
// cascading results but we need to make sure to update
// mInEffectForCascadeResults or else we'll keep running this
// code every time (potentially leading to infinite recursion due
// to the fact that this method both calls and is (indirectly) called
// by nsTransitionManager).
anim->mInEffectForCascadeResults = anim->IsInEffect();
}
// Notify the transition manager, whose results might depend on ours.
mPresContext->TransitionManager()->
UpdateCascadeResultsWithAnimations(aCollection);