From 2658cfcde7c636da8a8c7a9e36980ec712a21923 Mon Sep 17 00:00:00 2001 From: Mantaroh Yoshinaga Date: Fri, 10 Feb 2017 12:32:44 +0900 Subject: [PATCH] Bug 1302648 part 3 - Change order of releasing owning element when cancel animation. r=birtles The first step of Animation::Cancel(), it will release owning element. However we will use owning element for queueing the CSS-Animations event, So we will need to release owning element after calling Animation::Cancel() in order to fire the animationcancel event. MozReview-Commit-ID: ATqkIGkqREx --HG-- extra : rebase_source : 9b04dc59349d1203d5f8604516fcc6765cf3d5a7 --- layout/style/nsAnimationManager.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/layout/style/nsAnimationManager.h b/layout/style/nsAnimationManager.h index e0619f64318f..94779af724a0 100644 --- a/layout/style/nsAnimationManager.h +++ b/layout/style/nsAnimationManager.h @@ -110,7 +110,6 @@ public: void PauseFromStyle(); void CancelFromStyle() override { - mOwningElement = OwningElementRef(); // When an animation is disassociated with style it enters an odd state // where its composite order is undefined until it first transitions @@ -126,6 +125,11 @@ public: mNeedsNewAnimationIndexWhenRun = true; Animation::CancelFromStyle(); + + // We need to do this *after* calling CancelFromStyle() since + // CancelFromStyle might synchronously trigger a cancel event for which + // we need an owning element to target the event at. + mOwningElement = OwningElementRef(); } void Tick() override;