/src/mozilla-central/dom/animation/AnimationTimeline.cpp
Line | Count | Source (jump to first uncovered line) |
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/. */ |
6 | | |
7 | | #include "AnimationTimeline.h" |
8 | | #include "mozilla/AnimationComparator.h" |
9 | | #include "mozilla/dom/Animation.h" |
10 | | |
11 | | namespace mozilla { |
12 | | namespace dom { |
13 | | |
14 | | NS_IMPL_CYCLE_COLLECTION_CLASS(AnimationTimeline) |
15 | | |
16 | 0 | NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(AnimationTimeline) |
17 | 0 | tmp->mAnimationOrder.clear(); |
18 | 0 | NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindow, mAnimations) |
19 | 0 | NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER |
20 | 0 | NS_IMPL_CYCLE_COLLECTION_UNLINK_END |
21 | | |
22 | 0 | NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(AnimationTimeline) |
23 | 0 | NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow, mAnimations) |
24 | 0 | NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END |
25 | | |
26 | | NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(AnimationTimeline) |
27 | | |
28 | | NS_IMPL_CYCLE_COLLECTING_ADDREF(AnimationTimeline) |
29 | | NS_IMPL_CYCLE_COLLECTING_RELEASE(AnimationTimeline) |
30 | | |
31 | 0 | NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AnimationTimeline) |
32 | 0 | NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY |
33 | 0 | NS_INTERFACE_MAP_ENTRY(nsISupports) |
34 | 0 | NS_INTERFACE_MAP_END |
35 | | |
36 | | void |
37 | | AnimationTimeline::NotifyAnimationUpdated(Animation& aAnimation) |
38 | 0 | { |
39 | 0 | if (mAnimations.EnsureInserted(&aAnimation)) { |
40 | 0 | if (aAnimation.GetTimeline() && aAnimation.GetTimeline() != this) { |
41 | 0 | aAnimation.GetTimeline()->RemoveAnimation(&aAnimation); |
42 | 0 | } |
43 | 0 | mAnimationOrder.insertBack(&aAnimation); |
44 | 0 | } |
45 | 0 | } |
46 | | |
47 | | void |
48 | | AnimationTimeline::RemoveAnimation(Animation* aAnimation) |
49 | 0 | { |
50 | 0 | MOZ_ASSERT(!aAnimation->GetTimeline() || aAnimation->GetTimeline() == this); |
51 | 0 | if (static_cast<LinkedListElement<Animation>*>(aAnimation)->isInList()) { |
52 | 0 | static_cast<LinkedListElement<Animation>*>(aAnimation)->remove(); |
53 | 0 | } |
54 | 0 | mAnimations.RemoveEntry(aAnimation); |
55 | 0 | } |
56 | | |
57 | | } // namespace dom |
58 | | } // namespace mozilla |