Bug 1070745 part 2 - Update AnimationPlayer IDL to enable play() and pause(); r=bz

We map play()/pause() to PlayFromJS/PauseFromJS internally so that internal
users don't accidentally call Play()/Pause() which flush style.
This commit is contained in:
Brian Birtles 2014-10-20 13:55:43 +09:00
Родитель 9d3da82395
Коммит 311c41828e
4 изменённых файлов: 41 добавлений и 1 удалений

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

@ -33,6 +33,34 @@ AnimationPlayer::GetCurrentTime() const
return AnimationUtils::TimeDurationToDouble(GetCurrentTimeDuration());
}
void
AnimationPlayer::Play()
{
// TODO
}
void
AnimationPlayer::Pause()
{
// TODO
}
void
AnimationPlayer::PlayFromJS()
{
// TODO (flush styles etc.)
Play();
}
void
AnimationPlayer::PauseFromJS()
{
Play();
// TODO (flush styles etc.)
}
void
AnimationPlayer::SetSource(Animation* aSource)
{

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

@ -6,7 +6,6 @@
#ifndef mozilla_dom_AnimationPlayer_h
#define mozilla_dom_AnimationPlayer_h
#include <algorithm> // for std::max
#include "nsWrapperCache.h"
#include "nsCycleCollectionParticipant.h"
#include "mozilla/Attributes.h"
@ -49,8 +48,15 @@ public:
AnimationTimeline* Timeline() const { return mTimeline; }
Nullable<double> GetStartTime() const;
Nullable<double> GetCurrentTime() const;
void Play();
void Pause();
bool IsRunningOnCompositor() const { return mIsRunningOnCompositor; }
// Wrapper functions for performing extra steps such as flushing
// style when calling from JS.
void PauseFromJS();
void PlayFromJS();
void SetSource(Animation* aSource);
void Tick();

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

@ -1,3 +1,5 @@
# -*- Mode:Python; tab-width:8; indent-tabs-mode:nil; c-basic-offset:8 -*- */
# vim: set ts=8 sts=4 et sw=4 tw=80: */
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

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

@ -28,8 +28,12 @@ interface AnimationPlayer {
readonly attribute Promise finished;
void cancel ();
void finish ();
*/
[BinaryName="playFromJS"]
void play ();
[BinaryName="pauseFromJS"]
void pause ();
/*
void reverse ();
*/
};