Bug 1691109 [wpt PR 27513] - Increase timeout duration for wpt/fetch/api/basic/keepal...
[gecko.git] / dom / animation / AnimationTimeline.cpp
blob10ec354929be3d0c2ab795db556ae97342500f24
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "AnimationTimeline.h"
8 #include "mozilla/AnimationComparator.h"
9 #include "mozilla/dom/Animation.h"
11 namespace mozilla::dom {
13 AnimationTimeline::~AnimationTimeline() { mAnimationOrder.clear(); }
15 NS_IMPL_CYCLE_COLLECTION_CLASS(AnimationTimeline)
17 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(AnimationTimeline)
18 tmp->mAnimationOrder.clear();
19 NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindow, mAnimations)
20 NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
21 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
23 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(AnimationTimeline)
24 NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow, mAnimations)
25 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
27 NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(AnimationTimeline)
29 NS_IMPL_CYCLE_COLLECTING_ADDREF(AnimationTimeline)
30 NS_IMPL_CYCLE_COLLECTING_RELEASE(AnimationTimeline)
32 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AnimationTimeline)
33 NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
34 NS_INTERFACE_MAP_ENTRY(nsISupports)
35 NS_INTERFACE_MAP_END
37 void AnimationTimeline::NotifyAnimationUpdated(Animation& aAnimation) {
38 if (mAnimations.EnsureInserted(&aAnimation)) {
39 if (aAnimation.GetTimeline() && aAnimation.GetTimeline() != this) {
40 aAnimation.GetTimeline()->RemoveAnimation(&aAnimation);
42 mAnimationOrder.insertBack(&aAnimation);
46 void AnimationTimeline::RemoveAnimation(Animation* aAnimation) {
47 MOZ_ASSERT(!aAnimation->GetTimeline() || aAnimation->GetTimeline() == this);
48 if (static_cast<LinkedListElement<Animation>*>(aAnimation)->isInList()) {
49 static_cast<LinkedListElement<Animation>*>(aAnimation)->remove();
51 mAnimations.RemoveEntry(aAnimation);
54 } // namespace mozilla::dom