Bug 1472900 - Rename mTimeStamp in AnimationEventInfo to mScheduledEventTimeStamp. r?birtles
It matches the name in the spec.
https://drafts.csswg.org/web-animations/#scheduled-event-time
MozReview-Commit-ID: EKoUNRfTVMJ
--- a/dom/animation/AnimationEventDispatcher.h
+++ b/dom/animation/AnimationEventDispatcher.h
@@ -21,74 +21,74 @@ class nsPresContext;
class nsRefreshDriver;
namespace mozilla {
struct AnimationEventInfo
{
RefPtr<dom::EventTarget> mTarget;
RefPtr<dom::Animation> mAnimation;
- TimeStamp mTimeStamp;
+ TimeStamp mScheduledEventTimeStamp;
typedef Variant<InternalTransitionEvent,
InternalAnimationEvent,
RefPtr<dom::AnimationPlaybackEvent>> EventVariant;
EventVariant mEvent;
// For CSS animation events
AnimationEventInfo(nsAtom* aAnimationName,
const NonOwningAnimationTarget& aTarget,
EventMessage aMessage,
double aElapsedTime,
- const TimeStamp& aTimeStamp,
+ const TimeStamp& aScheduledEventTimeStamp,
dom::Animation* aAnimation)
: mTarget(aTarget.mElement)
, mAnimation(aAnimation)
- , mTimeStamp(aTimeStamp)
+ , mScheduledEventTimeStamp(aScheduledEventTimeStamp)
, mEvent(EventVariant(InternalAnimationEvent(true, aMessage)))
{
InternalAnimationEvent& event = mEvent.as<InternalAnimationEvent>();
aAnimationName->ToString(event.mAnimationName);
// XXX Looks like nobody initialize WidgetEvent::time
event.mElapsedTime = aElapsedTime;
event.mPseudoElement =
nsCSSPseudoElements::PseudoTypeAsString(aTarget.mPseudoType);
}
// For CSS transition events
AnimationEventInfo(nsCSSPropertyID aProperty,
const NonOwningAnimationTarget& aTarget,
EventMessage aMessage,
double aElapsedTime,
- const TimeStamp& aTimeStamp,
+ const TimeStamp& aScheduledEventTimeStamp,
dom::Animation* aAnimation)
: mTarget(aTarget.mElement)
, mAnimation(aAnimation)
- , mTimeStamp(aTimeStamp)
+ , mScheduledEventTimeStamp(aScheduledEventTimeStamp)
, mEvent(EventVariant(InternalTransitionEvent(true, aMessage)))
{
InternalTransitionEvent& event = mEvent.as<InternalTransitionEvent>();
event.mPropertyName =
NS_ConvertUTF8toUTF16(nsCSSProps::GetStringValue(aProperty));
// XXX Looks like nobody initialize WidgetEvent::time
event.mElapsedTime = aElapsedTime;
event.mPseudoElement =
nsCSSPseudoElements::PseudoTypeAsString(aTarget.mPseudoType);
}
// For web animation events
AnimationEventInfo(const nsAString& aName,
RefPtr<dom::AnimationPlaybackEvent>&& aEvent,
- TimeStamp&& aTimeStamp,
+ TimeStamp&& aScheduledEventTimeStamp,
dom::Animation* aAnimation)
: mTarget(aAnimation)
, mAnimation(aAnimation)
- , mTimeStamp(std::move(aTimeStamp))
+ , mScheduledEventTimeStamp(std::move(aScheduledEventTimeStamp))
, mEvent(std::move(aEvent))
{
}
AnimationEventInfo(const AnimationEventInfo& aOther) = delete;
AnimationEventInfo& operator=(const AnimationEventInfo& aOther) = delete;
AnimationEventInfo(AnimationEventInfo&& aOther) = default;
AnimationEventInfo& operator=(AnimationEventInfo&& aOther) = default;
@@ -210,24 +210,26 @@ private:
"AnimationEventDispatcher should have disassociated from "
"nsRefreshDriver");
}
#endif
class AnimationEventInfoLessThan
{
public:
- bool operator()(const AnimationEventInfo& a, const AnimationEventInfo& b) const
+ bool operator()(const AnimationEventInfo& a,
+ const AnimationEventInfo& b) const
{
- if (a.mTimeStamp != b.mTimeStamp) {
+ if (a.mScheduledEventTimeStamp != b.mScheduledEventTimeStamp) {
// Null timestamps sort first
- if (a.mTimeStamp.IsNull() || b.mTimeStamp.IsNull()) {
- return a.mTimeStamp.IsNull();
+ if (a.mScheduledEventTimeStamp.IsNull() ||
+ b.mScheduledEventTimeStamp.IsNull()) {
+ return a.mScheduledEventTimeStamp.IsNull();
} else {
- return a.mTimeStamp < b.mTimeStamp;
+ return a.mScheduledEventTimeStamp < b.mScheduledEventTimeStamp;
}
}
// Events in the Web Animations spec are prior to CSS events.
if (a.IsWebAnimationEvent() != b.IsWebAnimationEvent()) {
return a.IsWebAnimationEvent();
}
--- a/layout/style/nsAnimationManager.cpp
+++ b/layout/style/nsAnimationManager.cpp
@@ -227,31 +227,31 @@ CSSAnimation::QueueEvents(const StickyTi
TimeStamp startTimeStamp = ElapsedTimeToTimeStamp(intervalStartTime);
TimeStamp endTimeStamp = ElapsedTimeToTimeStamp(intervalEndTime);
TimeStamp iterationTimeStamp = ElapsedTimeToTimeStamp(iterationStartTime);
AutoTArray<AnimationEventInfo, 2> events;
auto appendAnimationEvent = [&](EventMessage aMessage,
const StickyTimeDuration& aElapsedTime,
- const TimeStamp& aTimeStamp) {
+ const TimeStamp& aScheduledEventTimeStamp) {
double elapsedTime = aElapsedTime.ToSeconds();
if (aMessage == eAnimationCancel) {
// 0 is an inappropriate value for this callsite. What we need to do is
// use a single random value for all increasing times reportable.
// That is to say, whenever elapsedTime goes negative (because an
// animation restarts, something rewinds the animation, or otherwise)
// a new random value for the mix-in must be generated.
elapsedTime = nsRFPService::ReduceTimePrecisionAsSecs(elapsedTime, 0, TimerPrecisionType::RFPOnly);
}
events.AppendElement(AnimationEventInfo(mAnimationName,
mOwningElement.Target(),
aMessage,
elapsedTime,
- aTimeStamp,
+ aScheduledEventTimeStamp,
this));
};
// Handle cancel event first
if ((mPreviousPhase != AnimationPhase::Idle &&
mPreviousPhase != AnimationPhase::After) &&
currentPhase == AnimationPhase::Idle) {
TimeStamp activeTimeStamp = ElapsedTimeToTimeStamp(aActiveTime);
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -228,31 +228,31 @@ CSSTransition::QueueEvents(const StickyT
TimeStamp zeroTimeStamp = AnimationTimeToTimeStamp(zeroDuration);
TimeStamp startTimeStamp = ElapsedTimeToTimeStamp(intervalStartTime);
TimeStamp endTimeStamp = ElapsedTimeToTimeStamp(intervalEndTime);
AutoTArray<AnimationEventInfo, 3> events;
auto appendTransitionEvent = [&](EventMessage aMessage,
const StickyTimeDuration& aElapsedTime,
- const TimeStamp& aTimeStamp) {
+ const TimeStamp& aScheduledEventTimeStamp) {
double elapsedTime = aElapsedTime.ToSeconds();
if (aMessage == eTransitionCancel) {
// 0 is an inappropriate value for this callsite. What we need to do is
// use a single random value for all increasing times reportable.
// That is to say, whenever elapsedTime goes negative (because an
// animation restarts, something rewinds the animation, or otherwise)
// a new random value for the mix-in must be generated.
elapsedTime = nsRFPService::ReduceTimePrecisionAsSecs(elapsedTime, 0, TimerPrecisionType::RFPOnly);
}
events.AppendElement(AnimationEventInfo(TransitionProperty(),
mOwningElement.Target(),
aMessage,
elapsedTime,
- aTimeStamp,
+ aScheduledEventTimeStamp,
this));
};
// Handle cancel events first
if ((mPreviousTransitionPhase != TransitionPhase::Idle &&
mPreviousTransitionPhase != TransitionPhase::After) &&
currentPhase == TransitionPhase::Idle) {
TimeStamp activeTimeStamp = ElapsedTimeToTimeStamp(aActiveTime);