Bug 1096774 - Part 1: Implement Animation Constructor. r=birtles, r=smaug

This commit is contained in:
Hiroyuki Ikezoe 2016-01-16 19:02:00 -05:00
Родитель 2959708ab5
Коммит 4c0263a3ed
3 изменённых файлов: 34 добавлений и 1 удалений

Просмотреть файл

@ -83,6 +83,32 @@ namespace {
// Animation interface:
//
// ---------------------------------------------------------------------------
/* static */ already_AddRefed<Animation>
Animation::Constructor(const GlobalObject& aGlobal,
KeyframeEffectReadOnly* aEffect,
AnimationTimeline* aTimeline,
ErrorResult& aRv)
{
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
RefPtr<Animation> animation = new Animation(global);
if (!aTimeline) {
// Bug 1096776: We do not support null timeline yet.
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
if (!aEffect) {
// Bug 1049975: We do not support null effect yet.
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
animation->SetTimeline(aTimeline);
animation->SetEffect(aEffect);
return animation.forget();
}
void
Animation::SetId(const nsAString& aId)
{

Просмотреть файл

@ -90,6 +90,11 @@ public:
};
// Animation interface methods
static already_AddRefed<Animation>
Constructor(const GlobalObject& aGlobal,
KeyframeEffectReadOnly* aEffect,
AnimationTimeline* aTimeline,
ErrorResult& aRv);
void GetId(nsAString& aResult) const { aResult = mId; }
void SetId(const nsAString& aId);
KeyframeEffectReadOnly* GetEffect() const { return mEffect; }

Просмотреть файл

@ -12,7 +12,9 @@
enum AnimationPlayState { "idle", "pending", "running", "paused", "finished" };
[Func="nsDocument::IsWebAnimationsEnabled"]
[Func="nsDocument::IsWebAnimationsEnabled",
Constructor (optional KeyframeEffectReadOnly? effect = null,
optional AnimationTimeline? timeline = null)]
interface Animation : EventTarget {
attribute DOMString id;
// Bug 1049975: Make 'effect' writeable