mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1040543 part 9 - Move IsFinishedTransition from AnimationPlayer to Animation; r=bz
As the third step in dividing functionality between AnimationPlayer and Animation this patch moves the mIsFinishedTransition member and related methods from AnimationPlayer to Animation. At the same time we rename SetFinishedTransition to SetIsFinishedTransition.
This commit is contained in:
parent
eee37dc2bd
commit
7cc2fe6201
@ -124,6 +124,7 @@ public:
|
||||
Animation(nsIDocument* aDocument, const AnimationTiming &aTiming)
|
||||
: mDocument(aDocument)
|
||||
, mTiming(aTiming)
|
||||
, mIsFinishedTransition(false)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
@ -181,7 +182,27 @@ public:
|
||||
// Return the duration of the active interval for the given timing parameters.
|
||||
static TimeDuration ActiveDuration(const AnimationTiming& aTiming);
|
||||
|
||||
// After transitions finish they need to be retained for one throttle-able
|
||||
// cycle (for reasons see explanation in
|
||||
// layout/style/nsTransitionManager.cpp).
|
||||
// In the meantime, however, they should be ignored.
|
||||
bool IsFinishedTransition() const {
|
||||
return mIsFinishedTransition;
|
||||
}
|
||||
|
||||
void SetIsFinishedTransition() {
|
||||
// FIXME: Restore assertion of AsTransition once we make transitions
|
||||
// a subclass of Animations
|
||||
// MOZ_ASSERT(AsTransition(),
|
||||
// "Calling SetIsFinishedTransition but it's not a transition");
|
||||
mIsFinishedTransition = true;
|
||||
}
|
||||
|
||||
bool IsCurrent() const {
|
||||
if (IsFinishedTransition()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ComputedTiming computedTiming = GetComputedTiming();
|
||||
return computedTiming.mPhase == ComputedTiming::AnimationPhase_Before ||
|
||||
computedTiming.mPhase == ComputedTiming::AnimationPhase_Active;
|
||||
@ -204,6 +225,10 @@ protected:
|
||||
Nullable<TimeDuration> mParentTime;
|
||||
|
||||
AnimationTiming mTiming;
|
||||
// A flag to mark transitions that have finished and are due to
|
||||
// be removed on the next throttle-able cycle.
|
||||
bool mIsFinishedTransition;
|
||||
|
||||
InfallibleTArray<AnimationProperty> mProperties;
|
||||
};
|
||||
|
||||
|
@ -73,7 +73,7 @@ AnimationPlayer::Tick()
|
||||
bool
|
||||
AnimationPlayer::IsRunning() const
|
||||
{
|
||||
if (IsPaused() || !GetSource() || IsFinishedTransition()) {
|
||||
if (IsPaused() || !GetSource() || GetSource()->IsFinishedTransition()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ AnimationPlayer::IsRunning() const
|
||||
bool
|
||||
AnimationPlayer::IsCurrent() const
|
||||
{
|
||||
return GetSource() && !IsFinishedTransition() && GetSource()->IsCurrent();
|
||||
return GetSource() && GetSource()->IsCurrent();
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
|
@ -36,7 +36,6 @@ protected:
|
||||
public:
|
||||
explicit AnimationPlayer(AnimationTimeline* aTimeline)
|
||||
: mIsRunningOnCompositor(false)
|
||||
, mIsFinishedTransition(false)
|
||||
, mLastNotification(LAST_NOTIFICATION_NONE)
|
||||
, mTimeline(aTimeline)
|
||||
{
|
||||
@ -70,18 +69,6 @@ public:
|
||||
return mPlayState == NS_STYLE_ANIMATION_PLAY_STATE_PAUSED;
|
||||
}
|
||||
|
||||
// After transitions finish they need to be retained for one throttle-able
|
||||
// cycle (for reasons see explanation in nsTransitionManager.cpp). In the
|
||||
// meantime, however, they should be ignored.
|
||||
bool IsFinishedTransition() const {
|
||||
return mIsFinishedTransition;
|
||||
}
|
||||
void SetFinishedTransition() {
|
||||
MOZ_ASSERT(AsTransition(),
|
||||
"Calling SetFinishedTransition but it's not a transition");
|
||||
mIsFinishedTransition = true;
|
||||
}
|
||||
|
||||
bool IsRunning() const;
|
||||
bool IsCurrent() const;
|
||||
|
||||
@ -112,9 +99,6 @@ public:
|
||||
TimeStamp mPauseStart;
|
||||
uint8_t mPlayState;
|
||||
bool mIsRunningOnCompositor;
|
||||
// A flag to mark transitions that have finished and are due to
|
||||
// be removed on the next throttle-able cycle.
|
||||
bool mIsFinishedTransition;
|
||||
|
||||
enum {
|
||||
LAST_NOTIFICATION_NONE = uint64_t(-1),
|
||||
|
@ -472,7 +472,7 @@ GetMinAndMaxScaleForAnimationProperty(nsIContent* aContent,
|
||||
|
||||
for (size_t playerIdx = collection->mPlayers.Length(); playerIdx-- != 0; ) {
|
||||
AnimationPlayer* player = collection->mPlayers[playerIdx];
|
||||
if (!player->GetSource() || player->IsFinishedTransition()) {
|
||||
if (!player->GetSource() || player->GetSource()->IsFinishedTransition()) {
|
||||
continue;
|
||||
}
|
||||
dom::Animation* anim = player->GetSource();
|
||||
|
@ -404,12 +404,9 @@ AnimationPlayerCollection::HasAnimationOfProperty(
|
||||
nsCSSProperty aProperty) const
|
||||
{
|
||||
for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) {
|
||||
const AnimationPlayer* player = mPlayers[playerIdx];
|
||||
const Animation* anim = player->GetSource();
|
||||
// FIXME: Drop the reference to the player once we move
|
||||
// IsFinishedTransition to Animation
|
||||
const Animation* anim = mPlayers[playerIdx]->GetSource();
|
||||
if (anim && anim->HasAnimationOfProperty(aProperty) &&
|
||||
!player->IsFinishedTransition()) {
|
||||
!anim->IsFinishedTransition()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -480,7 +477,7 @@ AnimationPlayerCollection::EnsureStyleRuleFor(TimeStamp aRefreshTime,
|
||||
// Skip player with no source content, finished transitions, or animations
|
||||
// whose @keyframes rule is empty.
|
||||
if (!player->GetSource() ||
|
||||
player->IsFinishedTransition() ||
|
||||
player->GetSource()->IsFinishedTransition() ||
|
||||
player->GetSource()->Properties().IsEmpty()) {
|
||||
continue;
|
||||
}
|
||||
@ -523,7 +520,7 @@ AnimationPlayerCollection::EnsureStyleRuleFor(TimeStamp aRefreshTime,
|
||||
for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) {
|
||||
AnimationPlayer* player = mPlayers[playerIdx];
|
||||
|
||||
if (!player->GetSource() || player->IsFinishedTransition()) {
|
||||
if (!player->GetSource() || player->GetSource()->IsFinishedTransition()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -41,10 +41,11 @@ using namespace mozilla::css;
|
||||
double
|
||||
ElementPropertyTransition::CurrentValuePortion() const
|
||||
{
|
||||
MOZ_ASSERT(GetSource(), "Transitions should have source content");
|
||||
// It would be easy enough to handle finished transitions by using a time
|
||||
// fraction of 1 but currently we should not be called for finished
|
||||
// transitions.
|
||||
MOZ_ASSERT(!IsFinishedTransition(),
|
||||
MOZ_ASSERT(!GetSource()->IsFinishedTransition(),
|
||||
"Getting the value portion of a finished transition");
|
||||
MOZ_ASSERT(!GetCurrentTimeDuration().IsNull(),
|
||||
"Getting the value portion of an animation that's not being "
|
||||
@ -56,7 +57,6 @@ ElementPropertyTransition::CurrentValuePortion() const
|
||||
// causing us to get called *after* the animation interval. So, just in
|
||||
// case, we override the fill mode to 'both' to ensure the time fraction
|
||||
// is never null.
|
||||
MOZ_ASSERT(GetSource(), "Transitions should have source content");
|
||||
AnimationTiming timingToUse = GetSource()->Timing();
|
||||
timingToUse.mFillMode = NS_STYLE_ANIMATION_FILL_MODE_BOTH;
|
||||
ComputedTiming computedTiming = GetSource()->GetComputedTiming(&timingToUse);
|
||||
@ -461,7 +461,7 @@ nsTransitionManager::ConsiderStartingTransition(
|
||||
// If the new transition reverses an existing one, we'll need to
|
||||
// handle the timing differently.
|
||||
if (haveCurrentTransition &&
|
||||
!oldPT->IsFinishedTransition() &&
|
||||
!oldPT->GetSource()->IsFinishedTransition() &&
|
||||
oldPT->mStartForReversingTest == endValue) {
|
||||
// Compute the appropriate negative transition-delay such that right
|
||||
// now we'd end up at the current position.
|
||||
@ -778,7 +778,7 @@ nsTransitionManager::FlushTransitions(FlushFlags aFlags)
|
||||
do {
|
||||
--i;
|
||||
AnimationPlayer* player = collection->mPlayers[i];
|
||||
if (player->IsFinishedTransition()) {
|
||||
if (player->GetSource()->IsFinishedTransition()) {
|
||||
// Actually remove transitions one throttle-able cycle after their
|
||||
// completion. We only clear on a throttle-able cycle because that
|
||||
// means it is a regular restyle tick and thus it is safe to discard
|
||||
@ -814,7 +814,7 @@ nsTransitionManager::FlushTransitions(FlushFlags aFlags)
|
||||
// a non-animation style change that would affect it, we need
|
||||
// to know not to start a new transition for the transition
|
||||
// from the almost-completed value to the final value.
|
||||
player->SetFinishedTransition();
|
||||
player->GetSource()->SetIsFinishedTransition();
|
||||
collection->UpdateAnimationGeneration(mPresContext);
|
||||
transitionStartedOrEnded = true;
|
||||
} else if ((computedTiming.mPhase ==
|
||||
|
Loading…
Reference in New Issue
Block a user