Bug 1340322 - Part 13: Update CSS Animations with servo's computed values. r=birtles

MozReview-Commit-ID: B7uSH7wrx3b
This commit is contained in:
Hiroyuki Ikezoe
2017-03-06 10:09:47 +09:00
parent 701883463d
commit 333a632f95
2 changed files with 20 additions and 26 deletions

View File

@@ -168,13 +168,19 @@ ServoStyleSet::GetContext(already_AddRefed<ServoComputedValues> aComputedValues,
aElementForAnimation->IsInComposedDoc()) {
// Update/build CSS animations in the case where animation properties are
// changed.
// FIXME: This isn't right place to update CSS animations. We should do it
// , presumably, in cascade_node() in servo side and process the initial
// restyle there too.
// To do that we need to make updating CSS animations process independent
// from nsStyleContext. Also we need to make the process thread safe.
mPresContext->AnimationManager()->UpdateAnimations(result,
aElementForAnimation);
// FIXME: Bug 1341985: This isn't right place to update CSS animations.
// We should do it in a SequentialTask and trigger the second traversal for
// the animation's restyle after the SequentialTask.
const ServoComputedValues* currentStyle =
result->StyleSource().AsServoComputedValues();
const ServoComputedValues* parentStyle =
result->GetParent()
? result->GetParent()->StyleSource().AsServoComputedValues()
: nullptr;
mPresContext->AnimationManager()->UpdateAnimations(aElementForAnimation,
aPseudoTag,
currentStyle,
parentStyle);
}
return result.forget();

View File

@@ -642,28 +642,16 @@ GeckoCSSAnimationBuilder::BuildKeyframes(nsPresContext* aPresContext,
nsTArray<Keyframe>& aKeyframes)
{
MOZ_ASSERT(aPresContext);
MOZ_ASSERT(aPresContext->StyleSet()->IsGecko());
if (aPresContext->StyleSet()->IsServo()) {
ServoStyleSet* styleSet = aPresContext->StyleSet()->AsServo();
MOZ_ASSERT(styleSet);
const ServoComputedValues* computedValues =
mStyleContext->StyleSource().AsServoComputedValues();
const nsTimingFunction& timingFunction = aSrc.GetTimingFunction();
if (!styleSet->FillKeyframesForName(aSrc.GetName(),
timingFunction,
computedValues,
aKeyframes)) {
return false;
}
} else {
nsCSSKeyframesRule* rule =
aPresContext->StyleSet()->AsGecko()->KeyframesRuleForName(aSrc.GetName());
if (!rule) {
return false;
}
aKeyframes = BuildAnimationFrames(aPresContext, aSrc, rule);
nsCSSKeyframesRule* rule =
aPresContext->StyleSet()->AsGecko()->KeyframesRuleForName(aSrc.GetName());
if (!rule) {
return false;
}
aKeyframes = BuildAnimationFrames(aPresContext, aSrc, rule);
return true;
}