Bug 1117603 part 1 - Don't assume style rules have been refreshed in GetAnimationRule; r=dbaron

Typically when GetAnimationRule is called, at least for CSS Animations, the
animation style rule will have been refreshed. However, in some cases such as
when the Web Animations API is used, the style rule will be marked as needing
to be refreshed outside of the usual flow. This rule will be refreshed when
nsAnimationManager::WillRefresh flushes animations but if the refresh driver
for the chrome document fires first, we will visit GetAnimationRule before
this happens.

This patch removes the assertion that expects animations to have been
refreshed by the time we reach GetAnimationRule causing it to update
the animation style rule as necessary.
This commit is contained in:
Brian Birtles 2015-03-24 09:06:06 +09:00
parent a6a532b672
commit e05c3df594

View File

@ -376,21 +376,13 @@ CommonAnimationManager::GetAnimationRule(mozilla::dom::Element* aElement,
return nullptr;
}
// Animations should already be refreshed, but transitions may not be.
// Note that this is temporary, we would like both animations and transitions
// to both be refreshed by this point.
if (IsAnimationManager()) {
NS_WARN_IF_FALSE(!collection->mNeedsRefreshes ||
collection->mStyleRuleRefreshTime ==
mPresContext->RefreshDriver()->MostRecentRefresh(),
"should already have refreshed style rule");
} else {
// FIXME: Remove this assignment. See bug 1061364.
// FIXME: Remove this assignment. See bug 1061364.
if (!IsAnimationManager()) {
collection->mNeedsRefreshes = true;
collection->EnsureStyleRuleFor(
mPresContext->RefreshDriver()->MostRecentRefresh(),
EnsureStyleRule_IsNotThrottled);
}
collection->EnsureStyleRuleFor(
mPresContext->RefreshDriver()->MostRecentRefresh(),
EnsureStyleRule_IsNotThrottled);
return collection->mStyleRule;
}