Bug 927349 part 12 - Store the initial time of animations on layers so start times can be resolved after-the-fact; r=nical

This commit is contained in:
Brian Birtles 2014-12-22 09:35:41 +09:00
Родитель 1261ccde9b
Коммит bed7d564db
2 изменённых файлов: 13 добавлений и 0 удалений

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

@ -173,6 +173,11 @@ struct Animation {
// delay. If the delay is changed dynamically, the layer's data will
// be updated.
TimeStamp startTime;
// The value of the animation's current time at the moment it was created.
// For animations that are waiting to start, their startTime will be null.
// Once the animation is ready to start, we calculate an appropriate value
// of startTime such that we begin playback from initialCurrentTime.
TimeDuration initialCurrentTime;
TimeDuration duration;
// For each frame, the interpolation point is computed based on the
// startTime, the direction, the duration, and the current time.

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

@ -67,6 +67,12 @@
#include "nsCaret.h"
#include "nsISelection.h"
// GetCurrentTime is defined in winbase.h as zero argument macro forwarding to
// GetTickCount().
#ifdef GetCurrentTime
#undef GetCurrentTime
#endif
using namespace mozilla;
using namespace mozilla::layers;
using namespace mozilla::dom;
@ -358,6 +364,8 @@ AddAnimationForProperty(nsIFrame* aFrame, nsCSSProperty aProperty,
const AnimationTiming& timing = aPlayer->GetSource()->Timing();
animation->startTime() = aPlayer->Timeline()->ToTimeStamp(
aPlayer->GetStartTime().Value() + timing.mDelay);
animation->initialCurrentTime() = aPlayer->GetCurrentTime().Value()
- timing.mDelay;
animation->duration() = timing.mIterationDuration;
animation->iterationCount() = timing.mIterationCount;
animation->direction() = timing.mDirection;