summaryrefslogtreecommitdiff
path: root/layout
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-14 09:18:49 +0100
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-14 09:18:49 +0100
commit1de19fc0efc14af53f3e46fc324e2a6098b33776 (patch)
treefc446e07283ce3a086f4f83a2fa9e559ab544d5a /layout
parent56e88a24f4629d4134ee6bc8e731a5992e50a8a3 (diff)
downloaduxp-1de19fc0efc14af53f3e46fc324e2a6098b33776.tar.gz
Bug 1264125: Queue CSS related event when setting null target effect
Issue mcp-graveyard/UXP#55
Diffstat (limited to 'layout')
-rw-r--r--layout/style/nsTransitionManager.cpp52
-rw-r--r--layout/style/nsTransitionManager.h6
2 files changed, 45 insertions, 13 deletions
diff --git a/layout/style/nsTransitionManager.cpp b/layout/style/nsTransitionManager.cpp
index da12a0ecdb..abb9e23115 100644
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -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()
{
diff --git a/layout/style/nsTransitionManager.h b/layout/style/nsTransitionManager.h
index 80042adcdf..e2f198a407 100644
--- a/layout/style/nsTransitionManager.h
+++ b/layout/style/nsTransitionManager.h
@@ -243,6 +243,12 @@ protected:
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
// transition (if any).
//