Bug 1025709 part 5 - Replace aIsThrottled bool value with an enum; r=heycam

This commit is contained in:
Brian Birtles 2014-06-20 12:39:25 +09:00
parent ae594f7975
commit af843d9fd9
4 changed files with 18 additions and 10 deletions

View File

@ -243,7 +243,8 @@ CommonAnimationManager::UpdateThrottledStyle(dom::Element* aElement,
"Rule has level eTransitionSheet without transition on manager");
et->EnsureStyleRuleFor(
mPresContext->RefreshDriver()->MostRecentRefresh(), false);
mPresContext->RefreshDriver()->MostRecentRefresh(),
EnsureStyleRule_IsNotThrottled);
curRule.mRule = et->mStyleRule;
} else {
curRule.mRule = ruleNode->GetRule();
@ -616,7 +617,7 @@ CommonElementAnimationData::LogAsyncAnimationFailure(nsCString& aMessage,
void
CommonElementAnimationData::EnsureStyleRuleFor(TimeStamp aRefreshTime,
bool aIsThrottled)
EnsureStyleRuleFlags aFlags)
{
if (!mNeedsRefreshes) {
mStyleRuleRefreshTime = aRefreshTime;
@ -629,7 +630,7 @@ CommonElementAnimationData::EnsureStyleRuleFor(TimeStamp aRefreshTime,
// of animation behaviour (the styles of the animation disappear, or the fill
// mode behaviour). This loop checks for any finishing animations and forces
// the style recalculation if we find any.
if (aIsThrottled) {
if (aFlags == EnsureStyleRule_IsThrottled) {
for (uint32_t animIdx = mAnimations.Length(); animIdx-- != 0; ) {
ElementAnimation* anim = mAnimations[animIdx];
@ -653,13 +654,13 @@ CommonElementAnimationData::EnsureStyleRuleFor(TimeStamp aRefreshTime,
(computedTiming.mPhase == ComputedTiming::AnimationPhase_After &&
anim->mLastNotification != ElementAnimation::LAST_NOTIFICATION_END))
{
aIsThrottled = false;
aFlags = EnsureStyleRule_IsNotThrottled;
break;
}
}
}
if (aIsThrottled) {
if (aFlags == EnsureStyleRule_IsThrottled) {
return;
}

View File

@ -387,6 +387,11 @@ public:
typedef InfallibleTArray<nsRefPtr<ElementAnimation> > ElementAnimationPtrArray;
enum EnsureStyleRuleFlags {
EnsureStyleRule_IsThrottled,
EnsureStyleRule_IsNotThrottled
};
namespace css {
struct CommonElementAnimationData : public PRCList
@ -425,7 +430,7 @@ struct CommonElementAnimationData : public PRCList
// for changes to values (for example, nsAnimationManager provides
// CheckNeedsRefresh to register or unregister from observing the refresh
// driver when this value changes).
void EnsureStyleRuleFor(TimeStamp aRefreshTime, bool aIsThrottled);
void EnsureStyleRuleFor(TimeStamp aRefreshTime, EnsureStyleRuleFlags aFlags);
bool CanThrottleTransformChanges(mozilla::TimeStamp aTime);

View File

@ -250,7 +250,7 @@ void
nsAnimationManager::EnsureStyleRuleFor(ElementAnimations* aEA)
{
TimeStamp refreshTime = mPresContext->RefreshDriver()->MostRecentRefresh();
aEA->EnsureStyleRuleFor(refreshTime, false);
aEA->EnsureStyleRuleFor(refreshTime, EnsureStyleRule_IsNotThrottled);
aEA->GetEventsAt(refreshTime, mPendingEvents);
CheckNeedsRefresh();
}
@ -414,7 +414,7 @@ nsAnimationManager::CheckAnimationRule(nsStyleContext* aStyleContext,
ea->mAnimations.SwapElements(newAnimations);
ea->mNeedsRefreshes = true;
ea->EnsureStyleRuleFor(refreshTime, false);
ea->EnsureStyleRuleFor(refreshTime, EnsureStyleRule_IsNotThrottled);
ea->GetEventsAt(refreshTime, mPendingEvents);
CheckNeedsRefresh();
// We don't actually dispatch the mPendingEvents now. We'll either
@ -844,7 +844,9 @@ nsAnimationManager::FlushAnimations(FlushFlags aFlags)
ea->CanThrottleAnimation(now);
nsRefPtr<css::AnimValuesStyleRule> oldStyleRule = ea->mStyleRule;
ea->EnsureStyleRuleFor(now, canThrottleTick);
ea->EnsureStyleRuleFor(now, canThrottleTick
? EnsureStyleRule_IsThrottled
: EnsureStyleRule_IsNotThrottled);
ea->GetEventsAt(now, mPendingEvents);
CheckNeedsRefresh();
if (oldStyleRule != ea->mStyleRule) {

View File

@ -793,7 +793,7 @@ nsTransitionManager::WalkTransitionRule(ElementDependentRuleProcessorData* aData
et->mNeedsRefreshes = true;
et->EnsureStyleRuleFor(
aData->mPresContext->RefreshDriver()->MostRecentRefresh(),
false);
EnsureStyleRule_IsNotThrottled);
if (et->mStyleRule) {
aData->mRuleWalker->Forward(et->mStyleRule);