Bug 1412716 - De-templatize functions used for in nsAnimationManager. r?emilio
MozReview-Commit-ID: Kj4pLgmgF0x
--- a/layout/style/nsAnimationManager.cpp
+++ b/layout/style/nsAnimationManager.cpp
@@ -413,24 +413,23 @@ public:
keyframeEffect->RequestRestyle(EffectCompositor::RestyleType::Standard);
}
private:
const ComputedStyle* mComputedStyle;
};
-template<class BuilderType>
static void
UpdateOldAnimationPropertiesWithNew(
CSSAnimation& aOld,
TimingParams& aNewTiming,
nsTArray<Keyframe>&& aNewKeyframes,
bool aNewIsStylePaused,
- BuilderType& aBuilder)
+ ServoCSSAnimationBuilder& aBuilder)
{
bool animationChanged = false;
// Update the old from the new so we can keep the original object
// identity (and any expando properties attached to it).
if (aOld.GetEffect()) {
dom::AnimationEffectReadOnly* oldEffect = aOld.GetEffect();
animationChanged = oldEffect->SpecifiedTiming() != aNewTiming;
@@ -467,23 +466,22 @@ UpdateOldAnimationPropertiesWithNew(
if (animationChanged && aOld.IsRelevant()) {
nsNodeUtils::AnimationChanged(&aOld);
}
}
// Returns a new animation set up with given StyleAnimation.
// Or returns an existing animation matching StyleAnimation's name updated
// with the new StyleAnimation.
-template<class BuilderType>
static already_AddRefed<CSSAnimation>
BuildAnimation(nsPresContext* aPresContext,
const NonOwningAnimationTarget& aTarget,
const nsStyleDisplay& aStyleDisplay,
uint32_t animIdx,
- BuilderType& aBuilder,
+ ServoCSSAnimationBuilder& aBuilder,
nsAnimationManager::CSSAnimationCollection* aCollection)
{
MOZ_ASSERT(aPresContext);
nsAtom* animationName = aStyleDisplay.GetAnimationName(animIdx);
nsTArray<Keyframe> keyframes;
if (!aBuilder.BuildKeyframes(aPresContext,
animationName,
@@ -550,22 +548,21 @@ BuildAnimation(nsPresContext* aPresConte
}
aBuilder.NotifyNewOrRemovedAnimation(*animation);
return animation.forget();
}
-template<class BuilderType>
static nsAnimationManager::OwningCSSAnimationPtrArray
BuildAnimations(nsPresContext* aPresContext,
const NonOwningAnimationTarget& aTarget,
const nsStyleDisplay& aStyleDisplay,
- BuilderType& aBuilder,
+ ServoCSSAnimationBuilder& aBuilder,
nsAnimationManager::CSSAnimationCollection* aCollection,
nsTHashtable<nsRefPtrHashKey<nsAtom>>& aReferencedAnimations)
{
nsAnimationManager::OwningCSSAnimationPtrArray result;
for (size_t animIdx = aStyleDisplay.mAnimationNameCount; animIdx-- != 0;) {
nsAtom* name = aStyleDisplay.GetAnimationName(animIdx);
// CSS Animations whose animation-name does not match a @keyframes rule do
@@ -623,22 +620,21 @@ nsAnimationManager::UpdateAnimations(
}
NonOwningAnimationTarget target(aElement, aPseudoType);
ServoCSSAnimationBuilder builder(aComputedStyle);
DoUpdateAnimations(target, *disp, builder);
}
-template<class BuilderType>
void
nsAnimationManager::DoUpdateAnimations(
const NonOwningAnimationTarget& aTarget,
const nsStyleDisplay& aStyleDisplay,
- BuilderType& aBuilder)
+ ServoCSSAnimationBuilder& aBuilder)
{
// Everything that causes our animation data to change triggers a
// style change, which in turn triggers a non-animation restyle.
// Likewise, when we initially construct frames, we're not in a
// style change, but also not in an animation restyle.
CSSAnimationCollection* collection =
CSSAnimationCollection::GetAnimationCollection(aTarget.mElement,
--- a/layout/style/nsAnimationManager.h
+++ b/layout/style/nsAnimationManager.h
@@ -14,16 +14,17 @@
#include "mozilla/Keyframe.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/TimeStamp.h"
#include "nsISupportsImpl.h"
class nsIGlobalObject;
class ServoComputedData;
struct nsStyleDisplay;
+class ServoCSSAnimationBuilder;
namespace mozilla {
class ComputedStyle;
namespace css {
class Declaration;
} /* namespace css */
namespace dom {
class KeyframeEffectReadOnly;
@@ -345,16 +346,15 @@ private:
// This includes all animation names referenced regardless of whether a
// corresponding `@keyframes` rule is available.
//
// It may contain names which are no longer referenced, but it should always
// contain names which are currently referenced, so that it is usable for
// style invalidation.
nsTHashtable<nsRefPtrHashKey<nsAtom>> mMaybeReferencedAnimations;
- template<class BuilderType>
void DoUpdateAnimations(
const mozilla::NonOwningAnimationTarget& aTarget,
const nsStyleDisplay& aStyleDisplay,
- BuilderType& aBuilder);
+ ServoCSSAnimationBuilder& aBuilder);
};
#endif /* !defined(nsAnimationManager_h_) */