Bug 1228229 part 9 - Use EffectCompositor::UpdateCascadeResults; r=dbaron

--HG--
extra : rebase_source : c294befb9b57564f17c9c22d8fc0f37e7792eaed
This commit is contained in:
Brian Birtles 2016-01-06 11:04:05 +09:00
Родитель f14f3a2be8
Коммит 96f4a19af3
4 изменённых файлов: 35 добавлений и 11 удалений

Просмотреть файл

@ -51,6 +51,21 @@ FindAnimationsForCompositor(const nsIFrame* aFrame,
return false;
}
// The animation cascade will almost always be up-to-date by this point
// but there are some cases such as when we are restoring the refresh driver
// from test control after seeking where it might not be the case.
//
// Those cases are probably not important but just to be safe, let's make
// sure the cascade is up to date since if it *is* up to date, this is
// basically a no-op.
Maybe<Pair<dom::Element*, nsCSSPseudoElements::Type>> pseudoElement =
EffectCompositor::GetAnimationElementAndPseudoForFrame(aFrame);
if (pseudoElement) {
EffectCompositor::MaybeUpdateCascadeResults(pseudoElement->first(),
pseudoElement->second(),
aFrame->StyleContext());
}
if (!nsLayoutUtils::AreAsyncAnimationsEnabled()) {
if (nsLayoutUtils::IsAnimationLoggingEnabled()) {
nsCString message;

Просмотреть файл

@ -489,11 +489,21 @@ AnimationCollection::EnsureStyleRuleFor(TimeStamp aRefreshTime)
return;
}
if (mManager->IsAnimationManager()) {
// Update cascade results before updating the style rule, since the
// cascade results can influence the style rule.
static_cast<nsAnimationManager*>(mManager)->MaybeUpdateCascadeResults(this);
// Update cascade results before updating the style rule, since the
// cascade results can influence the style rule.
nsStyleContext* styleContext = nullptr;
{
dom::Element* elementToRestyle = GetElementToRestyle();
if (elementToRestyle) {
nsIFrame* frame = elementToRestyle->GetPrimaryFrame();
if (frame) {
styleContext = frame->StyleContext();
}
}
}
EffectCompositor::MaybeUpdateCascadeResults(mElement,
PseudoElementType(),
styleContext);
mStyleRuleRefreshTime = aRefreshTime;
mStyleRule = nullptr;

Просмотреть файл

@ -444,11 +444,6 @@ nsAnimationManager::CheckAnimationRule(nsStyleContext* aStyleContext,
if (newAnimations.IsEmpty()) {
if (collection) {
// There might be transitions that run now that animations don't
// override them.
mPresContext->TransitionManager()->
UpdateCascadeResultsWithAnimationsToBeDestroyed(collection);
collection->Destroy();
}
return nullptr;
@ -583,7 +578,9 @@ nsAnimationManager::CheckAnimationRule(nsStyleContext* aStyleContext,
newAnimations[newAnimIdx]->CancelFromStyle();
}
UpdateCascadeResults(aStyleContext, collection);
EffectCompositor::UpdateCascadeResults(aElement,
aStyleContext->GetPseudoType(),
aStyleContext);
TimeStamp refreshTime = mPresContext->RefreshDriver()->MostRecentRefresh();
collection->EnsureStyleRuleFor(refreshTime);

Просмотреть файл

@ -18,6 +18,7 @@
#include "nsRuleProcessorData.h"
#include "nsRuleWalker.h"
#include "nsCSSPropertySet.h"
#include "mozilla/EffectCompositor.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/StyleAnimationValue.h"
#include "mozilla/dom/DocumentTimeline.h"
@ -480,7 +481,8 @@ nsTransitionManager::StyleContextChanged(dom::Element *aElement,
"must have element transitions if we started any transitions");
if (collection) {
UpdateCascadeResultsWithTransitions(collection);
EffectCompositor::UpdateCascadeResults(aElement, pseudoType,
newStyleContext);
// Set the style rule refresh time to null so that EnsureStyleRuleFor
// creates a new style rule if we started *or* stopped transitions.