mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1123523 - Part 3: Store a flag on AnimationPlayer for whether it is exposed by Element.getAnimationPlayers(). r=birtles
This commit is contained in:
parent
b884528512
commit
bccd6c9b6d
@ -231,6 +231,7 @@ AnimationPlayer::SetSource(Animation* aSource)
|
||||
if (mSource) {
|
||||
mSource->SetParentTime(GetCurrentTime());
|
||||
}
|
||||
UpdateRelevance();
|
||||
}
|
||||
|
||||
void
|
||||
@ -316,6 +317,8 @@ AnimationPlayer::Cancel()
|
||||
|
||||
mHoldTime.SetNull();
|
||||
mStartTime.SetNull();
|
||||
|
||||
UpdateSourceContent();
|
||||
}
|
||||
|
||||
bool
|
||||
@ -329,6 +332,12 @@ AnimationPlayer::IsRunning() const
|
||||
return computedTiming.mPhase == ComputedTiming::AnimationPhase_Active;
|
||||
}
|
||||
|
||||
void
|
||||
AnimationPlayer::UpdateRelevance()
|
||||
{
|
||||
mIsRelevant = HasCurrentSource() || HasInEffectSource();
|
||||
}
|
||||
|
||||
bool
|
||||
AnimationPlayer::CanThrottle() const
|
||||
{
|
||||
@ -459,6 +468,7 @@ AnimationPlayer::UpdateSourceContent()
|
||||
{
|
||||
if (mSource) {
|
||||
mSource->SetParentTime(GetCurrentTime());
|
||||
UpdateRelevance();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ class AnimationPlayer : public nsISupports,
|
||||
public nsWrapperCache
|
||||
{
|
||||
protected:
|
||||
virtual ~AnimationPlayer() { }
|
||||
virtual ~AnimationPlayer() {}
|
||||
|
||||
public:
|
||||
explicit AnimationPlayer(AnimationTimeline* aTimeline)
|
||||
@ -56,6 +56,7 @@ public:
|
||||
, mIsPending(false)
|
||||
, mIsRunningOnCompositor(false)
|
||||
, mIsPreviousStateFinished(false)
|
||||
, mIsRelevant(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -191,6 +192,9 @@ public:
|
||||
return GetSource() && GetSource()->IsInEffect();
|
||||
}
|
||||
|
||||
bool IsRelevant() const { return mIsRelevant; }
|
||||
void UpdateRelevance();
|
||||
|
||||
void SetIsRunningOnCompositor() { mIsRunningOnCompositor = true; }
|
||||
void ClearIsRunningOnCompositor() { mIsRunningOnCompositor = false; }
|
||||
|
||||
@ -256,6 +260,9 @@ protected:
|
||||
// probably remove this and check if the promise has been settled yet
|
||||
// or not instead.
|
||||
bool mIsPreviousStateFinished; // Spec calls this "previous finished state"
|
||||
// Indicates that the player should be exposed in an element's
|
||||
// getAnimationPlayers() list.
|
||||
bool mIsRelevant;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -3188,7 +3188,7 @@ Element::GetAnimationPlayers(nsTArray<nsRefPtr<AnimationPlayer> >& aPlayers)
|
||||
playerIdx < collection->mPlayers.Length();
|
||||
playerIdx++) {
|
||||
AnimationPlayer* player = collection->mPlayers[playerIdx];
|
||||
if (player->HasCurrentSource() || player->HasInEffectSource()) {
|
||||
if (player->IsRelevant()) {
|
||||
aPlayers.AppendElement(player);
|
||||
}
|
||||
}
|
||||
|
@ -350,6 +350,10 @@ nsAnimationManager::CheckAnimationRule(nsStyleContext* aStyleContext,
|
||||
newPlayer = nullptr;
|
||||
newPlayers.ReplaceElementAt(newIdx, oldPlayer);
|
||||
collection->mPlayers.RemoveElementAt(oldIdx);
|
||||
|
||||
// We've touched the old animation's timing properties, so this
|
||||
// could update the old player's relevance.
|
||||
oldPlayer->UpdateRelevance();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user