Bug 1096776 - Part2. Remove animation associated timelline when setting the new timeline. r?birtles draft
authorMantaroh Yoshinaga <mantaroh@gmail.com>
Thu, 19 May 2016 11:38:11 +0900
changeset 368567 afdfd89ec1e3cec94e80c9a74a9dc9498992d2e5
parent 368566 bf91bd1f34c61037e46a859ff7a44bda690fdaa2
child 368568 ea45ff169d03778b46eba6f6c5056cfc77259498
child 368569 f0462c6fc5d590ea387d2f84e79199153cb68112
push id18586
push usermantaroh@gmail.com
push dateThu, 19 May 2016 02:39:23 +0000
reviewersbirtles
bugs1096776, 1223445
milestone49.0a1
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
dom/animation/Animation.cpp
--- 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);