From 2dee8a57ea74c9eace99a59aa40f9767eaccf976 Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Fri, 22 May 2015 13:46:26 +0900 Subject: [PATCH] Bug 1164813 - Make nsAnimationManager update cached in-effect status even when there is no frame; r=dbaron --- layout/style/crashtests/1164813-1.html | 33 +++++++++++++++++++++++++ layout/style/crashtests/crashtests.list | 1 + layout/style/nsAnimationManager.cpp | 12 +++++++++ 3 files changed, 46 insertions(+) create mode 100644 layout/style/crashtests/1164813-1.html diff --git a/layout/style/crashtests/1164813-1.html b/layout/style/crashtests/1164813-1.html new file mode 100644 index 00000000000..ee5a60ffd6d --- /dev/null +++ b/layout/style/crashtests/1164813-1.html @@ -0,0 +1,33 @@ + + + +
+
Searching
+
+ + diff --git a/layout/style/crashtests/crashtests.list b/layout/style/crashtests/crashtests.list index d45021c256e..7b12b0fa890 100644 --- a/layout/style/crashtests/crashtests.list +++ b/layout/style/crashtests/crashtests.list @@ -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 diff --git a/layout/style/nsAnimationManager.cpp b/layout/style/nsAnimationManager.cpp index 7fa774c7694..7e4bd29d57f 100644 --- a/layout/style/nsAnimationManager.cpp +++ b/layout/style/nsAnimationManager.cpp @@ -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);