--- a/layout/style/nsAnimationManager.cpp
+++ b/layout/style/nsAnimationManager.cpp
@@ -417,24 +417,24 @@ class MOZ_STACK_CLASS ServoCSSAnimationB
public:
explicit ServoCSSAnimationBuilder(const ServoStyleContext* aStyleContext)
: mStyleContext(aStyleContext)
{
MOZ_ASSERT(aStyleContext);
}
bool BuildKeyframes(nsPresContext* aPresContext,
- const StyleAnimation& aSrc,
+ nsAtom* aName,
+ const nsTimingFunction& aTimingFunction,
nsTArray<Keyframe>& aKeyframes)
{
ServoStyleSet* styleSet = aPresContext->StyleSet()->AsServo();
MOZ_ASSERT(styleSet);
- const nsTimingFunction& timingFunction = aSrc.GetTimingFunction();
- return styleSet->GetKeyframesForName(aSrc.GetName(),
- timingFunction,
+ return styleSet->GetKeyframesForName(aName,
+ aTimingFunction,
aKeyframes);
}
void SetKeyframes(KeyframeEffectReadOnly& aEffect,
nsTArray<Keyframe>&& aKeyframes)
{
aEffect.SetKeyframes(Move(aKeyframes), mStyleContext);
}
@@ -488,29 +488,30 @@ public:
: mStyleContext(aStyleContext)
, mTarget(aTarget)
{
MOZ_ASSERT(aStyleContext);
MOZ_ASSERT(aTarget.mElement);
}
bool BuildKeyframes(nsPresContext* aPresContext,
- const StyleAnimation& aSrc,
+ nsAtom* aName,
+ const nsTimingFunction& aTimingFunction,
nsTArray<Keyframe>& aKeyframs);
void SetKeyframes(KeyframeEffectReadOnly& aEffect,
nsTArray<Keyframe>&& aKeyframes)
{
aEffect.SetKeyframes(Move(aKeyframes), mStyleContext);
}
void NotifyNewOrRemovedAnimation(const Animation&) {}
private:
nsTArray<Keyframe> BuildAnimationFrames(nsPresContext* aPresContext,
- const StyleAnimation& aSrc,
+ const nsTimingFunction& aTimingFunction,
const nsCSSKeyframesRule* aRule);
Maybe<ComputedTimingFunction> GetKeyframeTimingFunction(
nsPresContext* aPresContext,
nsCSSKeyframeRule* aKeyframeRule,
const Maybe<ComputedTimingFunction>& aInheritedTimingFunction);
nsTArray<PropertyValuePair> GetKeyframePropertyValues(
nsPresContext* aPresContext,
nsCSSKeyframeRule* aKeyframeRule,
@@ -591,17 +592,20 @@ BuildAnimation(nsPresContext* aPresConte
const NonOwningAnimationTarget& aTarget,
const StyleAnimation& aSrc,
BuilderType& aBuilder,
nsAnimationManager::CSSAnimationCollection* aCollection)
{
MOZ_ASSERT(aPresContext);
nsTArray<Keyframe> keyframes;
- if (!aBuilder.BuildKeyframes(aPresContext, aSrc, keyframes)) {
+ if (!aBuilder.BuildKeyframes(aPresContext,
+ aSrc.GetName(),
+ aSrc.GetTimingFunction(),
+ keyframes)) {
return nullptr;
}
TimingParams timing = TimingParamsFromCSSParams(aSrc.GetDuration(),
aSrc.GetDelay(),
aSrc.GetIterationCount(),
aSrc.GetDirection(),
aSrc.GetFillMode());
@@ -658,37 +662,39 @@ BuildAnimation(nsPresContext* aPresConte
aBuilder.NotifyNewOrRemovedAnimation(*animation);
return animation.forget();
}
bool
GeckoCSSAnimationBuilder::BuildKeyframes(nsPresContext* aPresContext,
- const StyleAnimation& aSrc,
+ nsAtom* aName,
+ const nsTimingFunction& aTimingFunction,
nsTArray<Keyframe>& aKeyframes)
{
MOZ_ASSERT(aPresContext);
MOZ_ASSERT(aPresContext->StyleSet()->IsGecko());
nsCSSKeyframesRule* rule =
- aPresContext->StyleSet()->AsGecko()->KeyframesRuleForName(aSrc.GetName());
+ aPresContext->StyleSet()->AsGecko()->KeyframesRuleForName(aName);
if (!rule) {
return false;
}
- aKeyframes = BuildAnimationFrames(aPresContext, aSrc, rule);
+ aKeyframes = BuildAnimationFrames(aPresContext, aTimingFunction, rule);
return true;
}
nsTArray<Keyframe>
-GeckoCSSAnimationBuilder::BuildAnimationFrames(nsPresContext* aPresContext,
- const StyleAnimation& aSrc,
- const nsCSSKeyframesRule* aRule)
+GeckoCSSAnimationBuilder::BuildAnimationFrames(
+ nsPresContext* aPresContext,
+ const nsTimingFunction& aTimingFunction,
+ const nsCSSKeyframesRule* aRule)
{
// Ideally we'd like to build up a set of Keyframe objects that more-or-less
// reflect the keyframes as-specified in the @keyframes rule(s) so that
// authors get something intuitive when they call anim.effect.getKeyframes().
//
// That, however, proves to be difficult because the way CSS declarations are
// processed differs from how we are able to represent keyframes as
// JavaScript objects in the Web Animations API.
@@ -728,17 +734,17 @@ GeckoCSSAnimationBuilder::BuildAnimation
// for that matter) we resolve values on @keyframes down to computed values
// (thereby expanding shorthands and variable references) and then pick up the
// last value for each longhand property at each offset.
// FIXME: There is a pending spec change to make multiple @keyframes
// rules with the same name cascade but we don't support that yet.
Maybe<ComputedTimingFunction> inheritedTimingFunction =
- ConvertTimingFunction(aSrc.GetTimingFunction());
+ ConvertTimingFunction(aTimingFunction);
// First, make up Keyframe objects for each rule
nsTArray<Keyframe> keyframes;
nsCSSPropertyIDSet animatedProperties;
for (auto ruleIdx = 0, ruleEnd = aRule->StyleRuleCount();
ruleIdx != ruleEnd; ++ruleIdx) {
css::Rule* cssRule = aRule->GetStyleRuleAt(ruleIdx);