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.

--HG--
extra : commitid : 20j8RFhPyP9
extra : rebase_source : 9eb5376f3ad9f4a4a0a214bdbe5593f682316d5b
This commit is contained in:
Brian Birtles 2015-06-15 11:05:43 +09:00
parent e725d9bdb4
commit 6434e79a4b
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 ();
};