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>
ConvertTimingFunction(const nsTimingFunction& aTimingFunction);
template<class BuilderType>
static void
UpdateOldAnimationPropertiesWithNew(
CSSAnimation& aOld,
TimingParams& aNewTiming,
nsTArray<Keyframe>&& aNewKeyframes,
bool aNewIsStylePaused,
CSSAnimationBuilder& aBuilder)
BuilderType& aBuilder)
{
bool animationChanged = false;
@ -526,11 +527,12 @@ UpdateOldAnimationPropertiesWithNew(
// 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 StyleAnimation& aSrc,
CSSAnimationBuilder& aBuilder,
BuilderType& aBuilder,
nsAnimationManager::CSSAnimationCollection* aCollection)
{
MOZ_ASSERT(aPresContext);
@ -1030,12 +1032,13 @@ CSSAnimationBuilder::GetComputedValue(nsPresContext* aPresContext,
return result;
}
template<class BuilderType>
static nsAnimationManager::OwningCSSAnimationPtrArray
BuildAnimations(nsPresContext* aPresContext,
const NonOwningAnimationTarget& aTarget,
const nsStyleAutoArray<StyleAnimation>& aStyleAnimations,
uint32_t aStyleAnimationNameCount,
CSSAnimationBuilder& aBuilder,
BuilderType& aBuilder,
nsAnimationManager::CSSAnimationCollection* aCollection)
{
nsAnimationManager::OwningCSSAnimationPtrArray result;
@ -1089,11 +1092,12 @@ nsAnimationManager::UpdateAnimations(nsStyleContext* aStyleContext,
DoUpdateAnimations(target, *disp, builder);
}
template<class BuilderType>
void
nsAnimationManager::DoUpdateAnimations(
const NonOwningAnimationTarget& aTarget,
const nsStyleDisplay& aStyleDisplay,
CSSAnimationBuilder& aBuilder)
BuilderType& aBuilder)
{
// Everything that causes our animation data to change triggers a
// style change, which in turn triggers a non-animation restyle.

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

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