Bug 1340322 - Part 9: Templatize functions that will be used with servo's computed values. r=birtles

MozReview-Commit-ID: 8d5wHBhF4y9

--HG--
extra : rebase_source : 767bd65e2e57e6e991c0725bb6b86a7cb4f427dc
This commit is contained in:
Hiroyuki Ikezoe 2017-03-06 09:51:16 +09:00
Родитель d0ed1e91e7
Коммит fccd7b4c32
2 изменённых файлов: 10 добавлений и 6 удалений

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

@ -473,13 +473,14 @@ private:
static Maybe<ComputedTimingFunction> static Maybe<ComputedTimingFunction>
ConvertTimingFunction(const nsTimingFunction& aTimingFunction); ConvertTimingFunction(const nsTimingFunction& aTimingFunction);
template<class BuilderType>
static void static void
UpdateOldAnimationPropertiesWithNew( UpdateOldAnimationPropertiesWithNew(
CSSAnimation& aOld, CSSAnimation& aOld,
TimingParams& aNewTiming, TimingParams& aNewTiming,
nsTArray<Keyframe>&& aNewKeyframes, nsTArray<Keyframe>&& aNewKeyframes,
bool aNewIsStylePaused, bool aNewIsStylePaused,
CSSAnimationBuilder& aBuilder) BuilderType& aBuilder)
{ {
bool animationChanged = false; bool animationChanged = false;
@ -526,11 +527,12 @@ UpdateOldAnimationPropertiesWithNew(
// Returns a new animation set up with given StyleAnimation. // Returns a new animation set up with given StyleAnimation.
// Or returns an existing animation matching StyleAnimation's name updated // Or returns an existing animation matching StyleAnimation's name updated
// with the new StyleAnimation. // with the new StyleAnimation.
template<class BuilderType>
static already_AddRefed<CSSAnimation> static already_AddRefed<CSSAnimation>
BuildAnimation(nsPresContext* aPresContext, BuildAnimation(nsPresContext* aPresContext,
const NonOwningAnimationTarget& aTarget, const NonOwningAnimationTarget& aTarget,
const StyleAnimation& aSrc, const StyleAnimation& aSrc,
CSSAnimationBuilder& aBuilder, BuilderType& aBuilder,
nsAnimationManager::CSSAnimationCollection* aCollection) nsAnimationManager::CSSAnimationCollection* aCollection)
{ {
MOZ_ASSERT(aPresContext); MOZ_ASSERT(aPresContext);
@ -1030,12 +1032,13 @@ CSSAnimationBuilder::GetComputedValue(nsPresContext* aPresContext,
return result; return result;
} }
template<class BuilderType>
static nsAnimationManager::OwningCSSAnimationPtrArray static nsAnimationManager::OwningCSSAnimationPtrArray
BuildAnimations(nsPresContext* aPresContext, BuildAnimations(nsPresContext* aPresContext,
const NonOwningAnimationTarget& aTarget, const NonOwningAnimationTarget& aTarget,
const nsStyleAutoArray<StyleAnimation>& aStyleAnimations, const nsStyleAutoArray<StyleAnimation>& aStyleAnimations,
uint32_t aStyleAnimationNameCount, uint32_t aStyleAnimationNameCount,
CSSAnimationBuilder& aBuilder, BuilderType& aBuilder,
nsAnimationManager::CSSAnimationCollection* aCollection) nsAnimationManager::CSSAnimationCollection* aCollection)
{ {
nsAnimationManager::OwningCSSAnimationPtrArray result; nsAnimationManager::OwningCSSAnimationPtrArray result;
@ -1089,11 +1092,12 @@ nsAnimationManager::UpdateAnimations(nsStyleContext* aStyleContext,
DoUpdateAnimations(target, *disp, builder); DoUpdateAnimations(target, *disp, builder);
} }
template<class BuilderType>
void void
nsAnimationManager::DoUpdateAnimations( nsAnimationManager::DoUpdateAnimations(
const NonOwningAnimationTarget& aTarget, const NonOwningAnimationTarget& aTarget,
const nsStyleDisplay& aStyleDisplay, const nsStyleDisplay& aStyleDisplay,
CSSAnimationBuilder& aBuilder) BuilderType& aBuilder)
{ {
// Everything that causes our animation data to change triggers a // Everything that causes our animation data to change triggers a
// style change, which in turn triggers a non-animation restyle. // style change, which in turn triggers a non-animation restyle.

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

@ -15,7 +15,6 @@
class nsIGlobalObject; class nsIGlobalObject;
class nsStyleContext; class nsStyleContext;
class CSSAnimationBuilder; // tentative, will be removed
struct nsStyleDisplay; struct nsStyleDisplay;
namespace mozilla { namespace mozilla {
@ -357,10 +356,11 @@ protected:
~nsAnimationManager() override = default; ~nsAnimationManager() override = default;
private: private:
template<class BuilderType>
void DoUpdateAnimations( void DoUpdateAnimations(
const mozilla::NonOwningAnimationTarget& aTarget, const mozilla::NonOwningAnimationTarget& aTarget,
const nsStyleDisplay& aStyleDisplay, const nsStyleDisplay& aStyleDisplay,
CSSAnimationBuilder& aBuilder); BuilderType& aBuilder);
mozilla::DelayedEventDispatcher<mozilla::AnimationEventInfo> mEventDispatcher; mozilla::DelayedEventDispatcher<mozilla::AnimationEventInfo> mEventDispatcher;
}; };