зеркало из https://github.com/mozilla/gecko-dev.git
Bug 550071 - SVG SMIL: Use refresh driver timestamp, not PR_Now; r=dholbert; a=blocking-betaN
This commit is contained in:
Родитель
dbfbaee7c1
Коммит
5b40118a94
|
@ -112,6 +112,13 @@ nsSMILAnimationController::Init(nsIDocument* aDoc)
|
|||
|
||||
// Keep track of document, so we can traverse its set of animation elements
|
||||
mDocument = aDoc;
|
||||
nsRefreshDriver* refreshDriver = GetRefreshDriverForDoc(mDocument);
|
||||
if (refreshDriver) {
|
||||
mStartTime = refreshDriver->MostRecentRefresh();
|
||||
} else {
|
||||
mStartTime = mozilla::TimeStamp::Now();
|
||||
}
|
||||
mCurrentSampleTime = mStartTime;
|
||||
|
||||
Begin();
|
||||
|
||||
|
@ -151,8 +158,7 @@ nsSMILAnimationController::Resume(PRUint32 aType)
|
|||
nsSMILTime
|
||||
nsSMILAnimationController::GetParentTime() const
|
||||
{
|
||||
// Our parent time is wallclock time
|
||||
return PR_Now() / PR_USEC_PER_MSEC;
|
||||
return (nsSMILTime)(mCurrentSampleTime - mStartTime).ToMilliseconds();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -164,9 +170,13 @@ NS_IMPL_RELEASE(nsSMILAnimationController)
|
|||
void
|
||||
nsSMILAnimationController::WillRefresh(mozilla::TimeStamp aTime)
|
||||
{
|
||||
// XXXdholbert Eventually we should be sampling based on aTime. For now,
|
||||
// though, we keep track of the time on our own, and we just use
|
||||
// nsRefreshDriver for scheduling samples.
|
||||
// Although we never expect aTime to go backwards, when we initialise the
|
||||
// animation controller, if we can't get hold of a refresh driver we
|
||||
// initialise mCurrentSampleTime to Now(). It may be possible that after
|
||||
// doing so we get sampled by a refresh driver whose most recent refresh time
|
||||
// predates when we were initialised, so to be safe we make sure to take the
|
||||
// most recent time here.
|
||||
mCurrentSampleTime = NS_MAX(mCurrentSampleTime, aTime);
|
||||
Sample();
|
||||
}
|
||||
|
||||
|
|
|
@ -70,8 +70,9 @@ class nsIDocument;
|
|||
class nsSMILAnimationController : public nsSMILTimeContainer,
|
||||
public nsARefreshObserver
|
||||
{
|
||||
public:
|
||||
protected:
|
||||
nsSMILAnimationController();
|
||||
public:
|
||||
~nsSMILAnimationController();
|
||||
|
||||
// nsSMILContainer
|
||||
|
@ -190,9 +191,10 @@ protected:
|
|||
nsAutoRefCnt mRefCnt;
|
||||
NS_DECL_OWNINGTHREAD
|
||||
|
||||
static const PRUint32 kTimerInterval;
|
||||
AnimationElementHashtable mAnimationElementTable;
|
||||
TimeContainerHashtable mChildContainerTable;
|
||||
mozilla::TimeStamp mCurrentSampleTime;
|
||||
mozilla::TimeStamp mStartTime;
|
||||
PRPackedBool mResampleNeeded;
|
||||
PRPackedBool mDeferredStartSampling;
|
||||
#ifdef DEBUG
|
||||
|
|
Загрузка…
Ссылка в новой задаче