зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1109390 part 12 - Update IsPaused to handle pause-pending players as well; r=jwatt
IsPaused is used in nsAnimationManager to detect if a newly created animation should be paused. It is also used inside AnimationPlayer::IsRunning which is used to determine what animations to send to the compositor (we don't send paused animations to the compositor). In all these cases we want to treat paused animations and pause-pending animations alike. This patch updates IsPaused to include also pause-pending animations. At the same time it renames IsPaused to IsPausedOrPausing to reflect the change in behavior. This patch also adjusts a few nearby one-line functions to put the opening brace on a new line since apparently this is what the coding style says to do.
This commit is contained in:
Родитель
c8f4410743
Коммит
c66558469d
|
@ -349,7 +349,9 @@ AnimationPlayer::Cancel()
|
|||
bool
|
||||
AnimationPlayer::IsRunning() const
|
||||
{
|
||||
if (IsPaused() || !GetSource() || GetSource()->IsFinishedTransition()) {
|
||||
if (IsPausedOrPausing() ||
|
||||
!GetSource() ||
|
||||
GetSource()->IsFinishedTransition()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -191,17 +191,24 @@ public:
|
|||
|
||||
void Cancel();
|
||||
|
||||
const nsString& Name() const {
|
||||
const nsString& Name() const
|
||||
{
|
||||
return mSource ? mSource->Name() : EmptyString();
|
||||
}
|
||||
|
||||
bool IsPaused() const { return PlayState() == AnimationPlayState::Paused; }
|
||||
bool IsPausedOrPausing() const
|
||||
{
|
||||
return PlayState() == AnimationPlayState::Paused ||
|
||||
mPendingState == PendingState::PausePending;
|
||||
}
|
||||
bool IsRunning() const;
|
||||
|
||||
bool HasCurrentSource() const {
|
||||
bool HasCurrentSource() const
|
||||
{
|
||||
return GetSource() && GetSource()->IsCurrent();
|
||||
}
|
||||
bool HasInEffectSource() const {
|
||||
bool HasInEffectSource() const
|
||||
{
|
||||
return GetSource() && GetSource()->IsInEffect();
|
||||
}
|
||||
|
||||
|
|
|
@ -348,11 +348,12 @@ nsAnimationManager::CheckAnimationRule(nsStyleContext* aStyleContext,
|
|||
// (We should check newPlayer->IsStylePaused() but that requires
|
||||
// downcasting to CSSAnimationPlayer and we happen to know that
|
||||
// newPlayer will only ever be paused by calling PauseFromStyle
|
||||
// making IsPaused synonymous in this case.)
|
||||
if (!oldPlayer->IsStylePaused() && newPlayer->IsPaused()) {
|
||||
// making IsPausedOrPausing synonymous in this case.)
|
||||
if (!oldPlayer->IsStylePaused() && newPlayer->IsPausedOrPausing()) {
|
||||
oldPlayer->PauseFromStyle();
|
||||
animationChanged = true;
|
||||
} else if (oldPlayer->IsStylePaused() && !newPlayer->IsPaused()) {
|
||||
} else if (oldPlayer->IsStylePaused() &&
|
||||
!newPlayer->IsPausedOrPausing()) {
|
||||
oldPlayer->PlayFromStyle();
|
||||
animationChanged = true;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче