mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-23 23:57:31 +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
|
|
@ -729,8 +729,10 @@ TimeStamp
|
||||||
Animation::ElapsedTimeToTimeStamp(
|
Animation::ElapsedTimeToTimeStamp(
|
||||||
const StickyTimeDuration& aElapsedTime) const
|
const StickyTimeDuration& aElapsedTime) const
|
||||||
{
|
{
|
||||||
return AnimationTimeToTimeStamp(aElapsedTime +
|
TimeDuration delay = mEffect
|
||||||
mEffect->SpecifiedTiming().mDelay);
|
? mEffect->SpecifiedTiming().mDelay
|
||||||
|
: TimeDuration();
|
||||||
|
return AnimationTimeToTimeStamp(aElapsedTime + delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -182,8 +182,7 @@ CSSTransition::UpdateTiming(SeekFlag aSeekFlag, SyncNotifyFlag aSyncNotifyFlag)
|
||||||
void
|
void
|
||||||
CSSTransition::QueueEvents(StickyTimeDuration aActiveTime)
|
CSSTransition::QueueEvents(StickyTimeDuration aActiveTime)
|
||||||
{
|
{
|
||||||
if (!mEffect ||
|
if (!mOwningElement.IsSet()) {
|
||||||
!mOwningElement.IsSet()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -197,14 +196,27 @@ CSSTransition::QueueEvents(StickyTimeDuration aActiveTime)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ComputedTiming computedTiming = mEffect->GetComputedTiming();
|
const StickyTimeDuration zeroDuration = StickyTimeDuration();
|
||||||
const StickyTimeDuration zeroDuration;
|
|
||||||
StickyTimeDuration intervalStartTime =
|
TransitionPhase currentPhase;
|
||||||
std::max(std::min(StickyTimeDuration(-mEffect->SpecifiedTiming().mDelay),
|
StickyTimeDuration intervalStartTime;
|
||||||
computedTiming.mActiveDuration), zeroDuration);
|
StickyTimeDuration intervalEndTime;
|
||||||
StickyTimeDuration intervalEndTime =
|
|
||||||
std::max(std::min((EffectEnd() - mEffect->SpecifiedTiming().mDelay),
|
if (!mEffect) {
|
||||||
computedTiming.mActiveDuration), zeroDuration);
|
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
|
// TimeStamps to use for ordering the events when they are dispatched. We
|
||||||
// use a TimeStamp so we can compare events produced by different elements,
|
// 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 startTimeStamp = ElapsedTimeToTimeStamp(intervalStartTime);
|
||||||
TimeStamp endTimeStamp = ElapsedTimeToTimeStamp(intervalEndTime);
|
TimeStamp endTimeStamp = ElapsedTimeToTimeStamp(intervalEndTime);
|
||||||
|
|
||||||
TransitionPhase currentPhase;
|
|
||||||
if (mPendingState != PendingState::NotPending &&
|
if (mPendingState != PendingState::NotPending &&
|
||||||
(mPreviousTransitionPhase == TransitionPhase::Idle ||
|
(mPreviousTransitionPhase == TransitionPhase::Idle ||
|
||||||
mPreviousTransitionPhase == TransitionPhase::Pending))
|
mPreviousTransitionPhase == TransitionPhase::Pending))
|
||||||
{
|
{
|
||||||
currentPhase = TransitionPhase::Pending;
|
currentPhase = TransitionPhase::Pending;
|
||||||
} else {
|
|
||||||
currentPhase = static_cast<TransitionPhase>(computedTiming.mPhase);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoTArray<TransitionEventParams, 3> events;
|
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
|
void
|
||||||
CSSTransition::Tick()
|
CSSTransition::Tick()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -243,6 +243,12 @@ protected:
|
||||||
|
|
||||||
void QueueEvents(StickyTimeDuration activeTime = StickyTimeDuration());
|
void QueueEvents(StickyTimeDuration activeTime = StickyTimeDuration());
|
||||||
|
|
||||||
|
|
||||||
|
enum class TransitionPhase;
|
||||||
|
// Return the TransitionPhase to use when the transition doesn't have a target
|
||||||
|
// effect.
|
||||||
|
TransitionPhase GetTransitionPhaseWithoutEffect() const;
|
||||||
|
|
||||||
// The (pseudo-)element whose computed transition-property refers to this
|
// The (pseudo-)element whose computed transition-property refers to this
|
||||||
// transition (if any).
|
// transition (if any).
|
||||||
//
|
//
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue