зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1025709 part 6 - Reuse nsAnimationManager::EnsureStyleRuleFor; r=heycam
In a number of places in nsAnimationManager we have the following sequence of calls: CommonElementAnimationData::EnsureStyleRuleFor ElementAnimations::GetEventsAt nsAnimationManager::CheckNeedsRefresh nsAnimationManager::EnsureStyleRuleFor already does exactly that so we should just reuse it. At the same time we rename EnsureStyleRuleFor to UpdateStyleAndEvents since that's a bit more accurate. It's also confusing to have two methods of the same name (but on different objects) that don't exactly correspond in terms of the scope of what they do.
This commit is contained in:
Родитель
95c414f550
Коммит
e8729cc7fd
|
@ -231,7 +231,9 @@ CommonAnimationManager::UpdateThrottledStyle(dom::Element* aElement,
|
|||
NS_ASSERTION(ea,
|
||||
"Rule has level eAnimationSheet without animation on manager");
|
||||
|
||||
mPresContext->AnimationManager()->EnsureStyleRuleFor(ea);
|
||||
mPresContext->AnimationManager()->UpdateStyleAndEvents(
|
||||
ea, mPresContext->RefreshDriver()->MostRecentRefresh(),
|
||||
EnsureStyleRule_IsNotThrottled);
|
||||
curRule.mRule = ea->mStyleRule;
|
||||
} else if (curRule.mLevel == nsStyleSet::eTransitionSheet) {
|
||||
ElementTransitions *et =
|
||||
|
|
|
@ -245,13 +245,13 @@ nsAnimationManager::GetElementAnimations(dom::Element *aElement,
|
|||
return ea;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsAnimationManager::EnsureStyleRuleFor(ElementAnimations* aEA)
|
||||
nsAnimationManager::UpdateStyleAndEvents(ElementAnimations* aEA,
|
||||
TimeStamp aRefreshTime,
|
||||
EnsureStyleRuleFlags aFlags)
|
||||
{
|
||||
TimeStamp refreshTime = mPresContext->RefreshDriver()->MostRecentRefresh();
|
||||
aEA->EnsureStyleRuleFor(refreshTime, EnsureStyleRule_IsNotThrottled);
|
||||
aEA->GetEventsAt(refreshTime, mPendingEvents);
|
||||
aEA->EnsureStyleRuleFor(aRefreshTime, aFlags);
|
||||
aEA->GetEventsAt(aRefreshTime, mPendingEvents);
|
||||
CheckNeedsRefresh();
|
||||
}
|
||||
|
||||
|
@ -414,9 +414,7 @@ nsAnimationManager::CheckAnimationRule(nsStyleContext* aStyleContext,
|
|||
ea->mAnimations.SwapElements(newAnimations);
|
||||
ea->mNeedsRefreshes = true;
|
||||
|
||||
ea->EnsureStyleRuleFor(refreshTime, EnsureStyleRule_IsNotThrottled);
|
||||
ea->GetEventsAt(refreshTime, mPendingEvents);
|
||||
CheckNeedsRefresh();
|
||||
UpdateStyleAndEvents(ea, refreshTime, EnsureStyleRule_IsNotThrottled);
|
||||
// We don't actually dispatch the mPendingEvents now. We'll either
|
||||
// dispatch them the next time we get a refresh driver notification
|
||||
// or the next time somebody calls
|
||||
|
@ -844,11 +842,9 @@ nsAnimationManager::FlushAnimations(FlushFlags aFlags)
|
|||
ea->CanThrottleAnimation(now);
|
||||
|
||||
nsRefPtr<css::AnimValuesStyleRule> oldStyleRule = ea->mStyleRule;
|
||||
ea->EnsureStyleRuleFor(now, canThrottleTick
|
||||
? EnsureStyleRule_IsThrottled
|
||||
: EnsureStyleRule_IsNotThrottled);
|
||||
ea->GetEventsAt(now, mPendingEvents);
|
||||
CheckNeedsRefresh();
|
||||
UpdateStyleAndEvents(ea, now, canThrottleTick
|
||||
? EnsureStyleRule_IsThrottled
|
||||
: EnsureStyleRule_IsNotThrottled);
|
||||
if (oldStyleRule != ea->mStyleRule) {
|
||||
ea->PostRestyleForAnimation(mPresContext);
|
||||
} else {
|
||||
|
|
|
@ -136,7 +136,9 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
void EnsureStyleRuleFor(ElementAnimations* aET);
|
||||
void UpdateStyleAndEvents(ElementAnimations* aEA,
|
||||
TimeStamp aRefreshTime,
|
||||
mozilla::EnsureStyleRuleFlags aFlags);
|
||||
|
||||
// nsIStyleRuleProcessor (parts)
|
||||
virtual void RulesMatching(ElementRuleProcessorData* aData) MOZ_OVERRIDE;
|
||||
|
|
Загрузка…
Ссылка в новой задаче