本文整理汇总了C++中PendingAnimationTracker::AddPausePending方法的典型用法代码示例。如果您正苦于以下问题:C++ PendingAnimationTracker::AddPausePending方法的具体用法?C++ PendingAnimationTracker::AddPausePending怎么用?C++ PendingAnimationTracker::AddPausePending使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PendingAnimationTracker
的用法示例。
在下文中一共展示了PendingAnimationTracker::AddPausePending方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CancelPendingTasks
// http://w3c.github.io/web-animations/#pause-an-animation
void
Animation::DoPause(ErrorResult& aRv)
{
if (IsPausedOrPausing()) {
return;
}
// If we are transitioning from idle, fill in the current time
if (GetCurrentTime().IsNull()) {
if (mPlaybackRate >= 0.0) {
mHoldTime.SetValue(TimeDuration(0));
} else {
if (EffectEnd() == TimeDuration::Forever()) {
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return;
}
mHoldTime.SetValue(TimeDuration(EffectEnd()));
}
}
bool reuseReadyPromise = false;
if (mPendingState == PendingState::PlayPending) {
CancelPendingTasks();
reuseReadyPromise = true;
}
// Mark this as no longer running on the compositor so that next time
// we update animations we won't throttle them and will have a chance
// to remove the animation from any layer it might be on.
mIsRunningOnCompositor = false;
if (!reuseReadyPromise) {
// Clear ready promise. We'll create a new one lazily.
mReady = nullptr;
}
mPendingState = PendingState::PausePending;
nsIDocument* doc = GetRenderedDocument();
if (doc) {
PendingAnimationTracker* tracker =
doc->GetOrCreatePendingAnimationTracker();
tracker->AddPausePending(*this);
} else {
TriggerOnNextTick(Nullable<TimeDuration>());
}
UpdateTiming(SeekFlag::NoSeek, SyncNotifyFlag::Async);
}
示例2: mb
// https://w3c.github.io/web-animations/#pause-an-animation
void
Animation::DoPause(ErrorResult& aRv)
{
if (IsPausedOrPausing()) {
return;
}
AutoMutationBatchForAnimation mb(*this);
// If we are transitioning from idle, fill in the current time
if (GetCurrentTime().IsNull()) {
if (mPlaybackRate >= 0.0) {
mHoldTime.SetValue(TimeDuration(0));
} else {
if (EffectEnd() == TimeDuration::Forever()) {
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return;
}
mHoldTime.SetValue(TimeDuration(EffectEnd()));
}
}
bool reuseReadyPromise = false;
if (mPendingState == PendingState::PlayPending) {
CancelPendingTasks();
reuseReadyPromise = true;
}
if (!reuseReadyPromise) {
// Clear ready promise. We'll create a new one lazily.
mReady = nullptr;
}
mPendingState = PendingState::PausePending;
nsIDocument* doc = GetRenderedDocument();
if (doc) {
PendingAnimationTracker* tracker =
doc->GetOrCreatePendingAnimationTracker();
tracker->AddPausePending(*this);
} else {
TriggerOnNextTick(Nullable<TimeDuration>());
}
UpdateTiming(SeekFlag::NoSeek, SyncNotifyFlag::Async);
if (IsRelevant()) {
nsNodeUtils::AnimationChanged(this);
}
}
示例3: CancelPendingTasks
// http://w3c.github.io/web-animations/#pause-an-animation
void
Animation::DoPause()
{
if (IsPausedOrPausing()) {
return;
}
bool reuseReadyPromise = false;
if (mPendingState == PendingState::PlayPending) {
CancelPendingTasks();
reuseReadyPromise = true;
}
// Mark this as no longer running on the compositor so that next time
// we update animations we won't throttle them and will have a chance
// to remove the animation from any layer it might be on.
mIsRunningOnCompositor = false;
if (!reuseReadyPromise) {
// Clear ready promise. We'll create a new one lazily.
mReady = nullptr;
}
mPendingState = PendingState::PausePending;
nsIDocument* doc = GetRenderedDocument();
if (!doc) {
TriggerOnNextTick(Nullable<TimeDuration>());
return;
}
PendingAnimationTracker* tracker = doc->GetOrCreatePendingAnimationTracker();
tracker->AddPausePending(*this);
UpdateFinishedState();
}
示例4: mb
// https://w3c.github.io/web-animations/#setting-the-target-effect
void
Animation::SetEffectNoUpdate(AnimationEffectReadOnly* aEffect)
{
RefPtr<Animation> kungFuDeathGrip(this);
if (mEffect == aEffect) {
return;
}
AutoMutationBatchForAnimation mb(*this);
bool wasRelevant = mIsRelevant;
if (mEffect) {
if (!aEffect) {
// If the new effect is null, call ResetPendingTasks before clearing
// mEffect since ResetPendingTasks needs it to get the appropriate
// PendingAnimationTracker.
ResetPendingTasks();
}
// We need to notify observers now because once we set mEffect to null
// we won't be able to find the target element to notify.
if (mIsRelevant) {
nsNodeUtils::AnimationRemoved(this);
}
// Break links with the old effect and then drop it.
RefPtr<AnimationEffectReadOnly> oldEffect = mEffect;
mEffect = nullptr;
oldEffect->SetAnimation(nullptr);
// The following will not do any notification because mEffect is null.
UpdateRelevance();
}
if (aEffect) {
// Break links from the new effect to its previous animation, if any.
RefPtr<AnimationEffectReadOnly> newEffect = aEffect;
Animation* prevAnim = aEffect->GetAnimation();
if (prevAnim) {
prevAnim->SetEffect(nullptr);
}
// Create links with the new effect. SetAnimation(this) will also update
// mIsRelevant of this animation, and then notify mutation observer if
// needed by calling Animation::UpdateRelevance(), so we don't need to
// call it again.
mEffect = newEffect;
mEffect->SetAnimation(this);
// Notify possible add or change.
// If the target is different, the change notification will be ignored by
// AutoMutationBatchForAnimation.
if (wasRelevant && mIsRelevant) {
nsNodeUtils::AnimationChanged(this);
}
// Reschedule pending pause or pending play tasks.
// If we have a pending animation, it will either be registered
// in the pending animation tracker and have a null pending ready time,
// or, after it has been painted, it will be removed from the tracker
// and assigned a pending ready time.
// After updating the effect we'll typically need to repaint so if we've
// already been assigned a pending ready time, we should clear it and put
// the animation back in the tracker.
if (!mPendingReadyTime.IsNull()) {
mPendingReadyTime.SetNull();
nsIDocument* doc = GetRenderedDocument();
if (doc) {
PendingAnimationTracker* tracker =
doc->GetOrCreatePendingAnimationTracker();
if (mPendingState == PendingState::PlayPending) {
tracker->AddPlayPending(*this);
} else {
tracker->AddPausePending(*this);
}
}
}
}
UpdateTiming(SeekFlag::NoSeek, SyncNotifyFlag::Async);
}