Bug 1150810 part 10 - Add AnimationTimeline::GetAnimations; r=jwatt; r=smaug

This patch also removes the (commented-out) play() method from the
AnimationTimeline.webidl since it has been removed from the spec.
This commit is contained in:
Brian Birtles 2015-06-15 11:05:43 +09:00
parent a86b008751
commit 565dd68a91
3 changed files with 24 additions and 3 deletions

View File

@ -19,6 +19,26 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AnimationTimeline)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
static PLDHashOperator
AppendAnimationToSequence(nsRefPtrHashKey<dom::Animation>* aKey,
void* aSequence)
{
Animation* animation = aKey->GetKey();
AnimationTimeline::AnimationSequence* sequence =
static_cast<AnimationTimeline::AnimationSequence*>(aSequence);
sequence->AppendElement(animation);
return PL_DHASH_NEXT;
}
void
AnimationTimeline::GetAnimations(AnimationSequence& aAnimations)
{
// FIXME: Flush the document here (fixed in a subsequent patch)
mAnimations.EnumerateEntries(AppendAnimationToSequence, &aAnimations);
}
void
AnimationTimeline::AddAnimation(Animation& aAnimation)
{

View File

@ -40,8 +40,11 @@ public:
nsIGlobalObject* GetParentObject() const { return mWindow; }
typedef nsTArray<nsRefPtr<Animation>> AnimationSequence;
// AnimationTimeline methods
virtual Nullable<TimeDuration> GetCurrentTime() const = 0;
void GetAnimations(AnimationSequence& aAnimations);
// Wrapper functions for AnimationTimeline DOM methods when called from
// script.

View File

@ -14,7 +14,5 @@
interface AnimationTimeline {
[BinaryName="currentTimeAsDouble"]
readonly attribute double? currentTime;
// Not yet implemented:
// Animation play (optional TimedItem? source = null);
// sequence<Animation> getAnimations ();
sequence<Animation> getAnimations ();
};