mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 23:38:38 +09:00
Bug 1264125: Queue CSS related event when setting null target effect
Issue #55
This commit is contained in:
parent
96037b8c9a
commit
c8ee9f4f48
3 changed files with 49 additions and 15 deletions
|
|
@ -182,8 +182,7 @@ CSSTransition::UpdateTiming(SeekFlag aSeekFlag, SyncNotifyFlag aSyncNotifyFlag)
|
|||
void
|
||||
CSSTransition::QueueEvents(StickyTimeDuration aActiveTime)
|
||||
{
|
||||
if (!mEffect ||
|
||||
!mOwningElement.IsSet()) {
|
||||
if (!mOwningElement.IsSet()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -197,14 +196,27 @@ CSSTransition::QueueEvents(StickyTimeDuration aActiveTime)
|
|||
return;
|
||||
}
|
||||
|
||||
ComputedTiming computedTiming = mEffect->GetComputedTiming();
|
||||
const StickyTimeDuration zeroDuration;
|
||||
StickyTimeDuration intervalStartTime =
|
||||
std::max(std::min(StickyTimeDuration(-mEffect->SpecifiedTiming().mDelay),
|
||||
computedTiming.mActiveDuration), zeroDuration);
|
||||
StickyTimeDuration intervalEndTime =
|
||||
std::max(std::min((EffectEnd() - mEffect->SpecifiedTiming().mDelay),
|
||||
computedTiming.mActiveDuration), zeroDuration);
|
||||
const StickyTimeDuration zeroDuration = StickyTimeDuration();
|
||||
|
||||
TransitionPhase currentPhase;
|
||||
StickyTimeDuration intervalStartTime;
|
||||
StickyTimeDuration intervalEndTime;
|
||||
|
||||
if (!mEffect) {
|
||||
currentPhase = GetTransitionPhaseWithoutEffect();
|
||||
intervalStartTime = zeroDuration;
|
||||
intervalEndTime = zeroDuration;
|
||||
} else {
|
||||
ComputedTiming computedTiming = mEffect->GetComputedTiming();
|
||||
|
||||
currentPhase = static_cast<TransitionPhase>(computedTiming.mPhase);
|
||||
intervalStartTime =
|
||||
std::max(std::min(StickyTimeDuration(-mEffect->SpecifiedTiming().mDelay),
|
||||
computedTiming.mActiveDuration), zeroDuration);
|
||||
intervalEndTime =
|
||||
std::max(std::min((EffectEnd() - mEffect->SpecifiedTiming().mDelay),
|
||||
computedTiming.mActiveDuration), zeroDuration);
|
||||
}
|
||||
|
||||
// TimeStamps to use for ordering the events when they are dispatched. We
|
||||
// use a TimeStamp so we can compare events produced by different elements,
|
||||
|
|
@ -215,14 +227,11 @@ CSSTransition::QueueEvents(StickyTimeDuration aActiveTime)
|
|||
TimeStamp startTimeStamp = ElapsedTimeToTimeStamp(intervalStartTime);
|
||||
TimeStamp endTimeStamp = ElapsedTimeToTimeStamp(intervalEndTime);
|
||||
|
||||
TransitionPhase currentPhase;
|
||||
if (mPendingState != PendingState::NotPending &&
|
||||
(mPreviousTransitionPhase == TransitionPhase::Idle ||
|
||||
mPreviousTransitionPhase == TransitionPhase::Pending))
|
||||
{
|
||||
currentPhase = TransitionPhase::Pending;
|
||||
} else {
|
||||
currentPhase = static_cast<TransitionPhase>(computedTiming.mPhase);
|
||||
}
|
||||
|
||||
AutoTArray<TransitionEventParams, 3> events;
|
||||
|
|
@ -320,6 +329,23 @@ CSSTransition::QueueEvents(StickyTimeDuration aActiveTime)
|
|||
}
|
||||
}
|
||||
|
||||
CSSTransition::TransitionPhase
|
||||
CSSTransition::GetTransitionPhaseWithoutEffect() const
|
||||
{
|
||||
MOZ_ASSERT(!mEffect, "Should only be called when we do not have an effect");
|
||||
|
||||
Nullable<TimeDuration> currentTime = GetCurrentTime();
|
||||
if (currentTime.IsNull()) {
|
||||
return TransitionPhase::Idle;
|
||||
}
|
||||
|
||||
// If we don't have a target effect, the duration will be zero so the phase is
|
||||
// 'before' if the current time is less than zero.
|
||||
return currentTime.Value() < TimeDuration()
|
||||
? TransitionPhase::Before
|
||||
: TransitionPhase::After;
|
||||
}
|
||||
|
||||
void
|
||||
CSSTransition::Tick()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue