Bug 1096776 - Part2. Remove animation associated timelline when setting the new timeline. r?birtles
We should remove relation of animation and timeline when setting the new
timeline.
In
bug 1223445, an animation class became child class of LinkedListElement, and
timeline has a LinkedList of an Animation object. These change work well when
animation can't set the new timeline.
However LinkedList doesn't allow insert new object which belong with other
list. So we can't set new timeline to animation when new timeline is belong with
other animation. See
bug 1096776 comment #4, for more detail.
MozReview-Commit-ID: FYXq5zrewMA
--- a/dom/animation/Animation.cpp
+++ b/dom/animation/Animation.cpp
@@ -138,16 +138,17 @@ void
Animation::SetTimeline(AnimationTimeline* aTimeline)
{
if (mTimeline == aTimeline) {
return;
}
if (mTimeline) {
mTimeline->NotifyAnimationUpdated(*this);
+ mTimeline->RemoveAnimation(this);
}
mTimeline = aTimeline;
// FIXME(spec): Once we implement the seeking defined in the spec
// surely this should be SeekFlag::DidSeek but the spec says otherwise.
UpdateTiming(SeekFlag::NoSeek, SyncNotifyFlag::Async);