Bug 1232577 part 10 - Remove AnimationCollection::mStyleChanging; r=heycam

This flag is no longer needed because in bug 1232563 we introduced a more
thorough optimization that detects when the animation is not changing by
comparing the progress value between samples and avoids requesting restyles
when it does not change.
This commit is contained in:
Brian Birtles 2016-01-13 07:54:54 +09:00
Родитель 71a9cf43cb
Коммит b29e0fc6c2
8 изменённых файлов: 10 добавлений и 43 удалений

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

@ -682,19 +682,12 @@ Animation::HasLowerCompositeOrderThan(const Animation& aOther) const
void
Animation::ComposeStyle(RefPtr<AnimValuesStyleRule>& aStyleRule,
nsCSSPropertySet& aSetProperties,
bool& aStyleChanging)
nsCSSPropertySet& aSetProperties)
{
if (!mEffect) {
return;
}
AnimationPlayState playState = PlayState();
if (playState == AnimationPlayState::Running ||
playState == AnimationPlayState::Pending) {
aStyleChanging = true;
}
if (!IsInEffect()) {
return;
}
@ -734,6 +727,7 @@ Animation::ComposeStyle(RefPtr<AnimValuesStyleRule>& aStyleRule,
// afterwards. This is purely to prevent visual flicker. Other behavior
// such as dispatching events continues to rely on the regular timeline time.
bool updatedHoldTime = false;
AnimationPlayState playState = PlayState();
{
AutoRestore<Nullable<TimeDuration>> restoreHoldTime(mHoldTime);

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

@ -307,13 +307,9 @@ public:
* if any.
* Any properties already contained in |aSetProperties| are not changed. Any
* properties that are changed are added to |aSetProperties|.
* |aStyleChanging| will be set to true if this animation expects to update
* the style rule on the next refresh driver tick as well (because it
* is running and has an effect to sample).
*/
void ComposeStyle(RefPtr<AnimValuesStyleRule>& aStyleRule,
nsCSSPropertySet& aSetProperties,
bool& aStyleChanging);
nsCSSPropertySet& aSetProperties);
void NotifyEffectTimingUpdated();

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

@ -182,8 +182,7 @@ void
EffectCompositor::MaybeUpdateAnimationRule(dom::Element* aElement,
nsCSSPseudoElements::Type
aPseudoType,
CascadeLevel aCascadeLevel,
bool& aStyleChanging)
CascadeLevel aCascadeLevel)
{
auto& elementsToRestyle = mElementsToRestyle[aCascadeLevel];
PseudoElementHashKey key = { aElement, aPseudoType };
@ -193,8 +192,7 @@ EffectCompositor::MaybeUpdateAnimationRule(dom::Element* aElement,
}
ComposeAnimationRule(aElement, aPseudoType, aCascadeLevel,
mPresContext->RefreshDriver()->MostRecentRefresh(),
aStyleChanging);
mPresContext->RefreshDriver()->MostRecentRefresh());
elementsToRestyle.Remove(key);
}
@ -360,8 +358,7 @@ EffectCompositor::GetAnimationElementAndPseudoForFrame(const nsIFrame* aFrame)
EffectCompositor::ComposeAnimationRule(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType,
CascadeLevel aCascadeLevel,
TimeStamp aRefreshTime,
bool& aStyleChanging)
TimeStamp aRefreshTime)
{
EffectSet* effects = EffectSet::GetEffectSet(aElement, aPseudoType);
if (!effects) {
@ -386,9 +383,6 @@ EffectCompositor::ComposeAnimationRule(dom::Element* aElement,
effects->AnimationRule(aCascadeLevel);
animationRule = nullptr;
// We'll set aStyleChanging to true below if necessary.
aStyleChanging = false;
// If multiple animations specify behavior for the same property the
// animation with the *highest* composite order wins.
// As a result, we iterate from last animation to first and, if a
@ -396,8 +390,7 @@ EffectCompositor::ComposeAnimationRule(dom::Element* aElement,
nsCSSPropertySet properties;
for (KeyframeEffectReadOnly* effect : Reversed(sortedEffectList)) {
effect->GetAnimation()->ComposeStyle(animationRule, properties,
aStyleChanging);
effect->GetAnimation()->ComposeStyle(animationRule, properties);
}
effects->UpdateAnimationRuleRefreshTime(aCascadeLevel, aRefreshTime);

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

@ -102,8 +102,7 @@ public:
// no work is done.
void MaybeUpdateAnimationRule(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType,
CascadeLevel aCascadeLevel,
bool& aStyleChanging);
CascadeLevel aCascadeLevel);
// FIXME: Temporary method until we move FlushAnimations here.
bool HasThrottledAnimations(dom::Element* aElement,
@ -161,8 +160,7 @@ private:
static void ComposeAnimationRule(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType,
CascadeLevel aCascadeLevel,
TimeStamp aRefreshTime,
bool& aStyleChanging);
TimeStamp aRefreshTime);
static dom::Element* GetElementToRestyle(dom::Element* aElement,
nsCSSPseudoElements::Type

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

@ -428,10 +428,6 @@ AnimationCollection::EnsureStyleRuleFor()
return;
}
if (!mStyleChanging) {
return;
}
// Update cascade results before updating the style rule, since the
// cascade results can influence the style rule.
nsStyleContext* styleContext = nullptr;
@ -454,8 +450,7 @@ AnimationCollection::EnsureStyleRuleFor()
EffectCompositor::CascadeLevel::Transitions;
presContext->EffectCompositor()->MaybeUpdateAnimationRule(mElement,
PseudoElementType(),
cascadeLevel,
mStyleChanging);
cascadeLevel);
}
void
@ -482,7 +477,6 @@ AnimationCollection::RequestRestyle(EffectCompositor::RestyleType aRestyleType)
// Steps for RestyleType::Layer:
if (aRestyleType == EffectCompositor::RestyleType::Layer) {
mStyleChanging = true;
// Prompt layers to re-sync their animations.
presContext->ClearLastStyleUpdateForAllAnimations();

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

@ -144,7 +144,6 @@ struct AnimationCollection : public LinkedListElement<AnimationCollection>
, mElementProperty(aElementProperty)
, mManager(aManager)
, mCheckGeneration(0)
, mStyleChanging(true)
, mHasPendingAnimationRestyle(false)
#ifdef DEBUG
, mCalledPropertyDtor(false)
@ -253,11 +252,6 @@ public:
// Update mCheckGeneration to RestyleManager's count
void UpdateCheckGeneration(nsPresContext* aPresContext);
// False when we know that our current animation rule is valid
// indefinitely into the future (because all of our animations are
// either completed or paused). May be invalidated by a style change.
bool mStyleChanging;
private:
// Whether or not we have already posted for animation restyle.
// This is used to avoid making redundant requests and is reset each time

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

@ -538,7 +538,6 @@ nsAnimationManager::CheckAnimationRule(nsStyleContext* aStyleContext,
}
}
collection->mAnimations.SwapElements(newAnimations);
collection->mStyleChanging = true;
// Cancel removed animations
for (size_t newAnimIdx = newAnimations.Length(); newAnimIdx-- != 0; ) {

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

@ -489,7 +489,6 @@ nsTransitionManager::StyleContextChanged(dom::Element *aElement,
newStyleContext);
collection->UpdateCheckGeneration(mPresContext);
collection->mStyleChanging = true;
collection->EnsureStyleRuleFor();
}