Bug 1344598 - Use nsIDocument::IsStyledByServo to check we are using servo or not. r?boris
MozReview-Commit-ID: 1yQUAwHy51
--- a/dom/animation/KeyframeEffectReadOnly.cpp
+++ b/dom/animation/KeyframeEffectReadOnly.cpp
@@ -532,18 +532,17 @@ KeyframeEffectReadOnly::ComposeStyle(
mCurrentIterationOnLastCompose = computedTiming.mCurrentIteration;
// If the progress is null, we don't have fill data for the current
// time so we shouldn't animate.
if (computedTiming.mProgress.IsNull()) {
return;
}
- nsPresContext* presContext = GetPresContext();
- bool isServoBackend = presContext && presContext->StyleSet()->IsServo();
+ bool isServoBackend = mDocument->IsStyledByServo();
for (size_t propIdx = 0, propEnd = mProperties.Length();
propIdx != propEnd; ++propIdx)
{
const AnimationProperty& prop = mProperties[propIdx];
MOZ_ASSERT(prop.mSegments[0].mFromKey == 0.0, "incorrect first from key");
MOZ_ASSERT(prop.mSegments[prop.mSegments.Length() - 1].mToKey == 1.0,
@@ -1613,17 +1612,17 @@ CreateStyleContextForAnimationValue(nsCS
return styleContext.forget();
}
void
KeyframeEffectReadOnly::CalculateCumulativeChangeHint(
nsStyleContext *aStyleContext)
{
- if (aStyleContext->PresContext()->StyleSet()->IsServo()) {
+ if (mDocument->IsStyledByServo()) {
// FIXME (bug 1303235): Do this for Servo too
return;
}
mCumulativeChangeHint = nsChangeHint(0);
for (const AnimationProperty& property : mProperties) {
for (const AnimationPropertySegment& segment : property.mSegments) {
// In case composite operation is not 'replace', we can't throttle
@@ -1687,18 +1686,17 @@ bool
KeyframeEffectReadOnly::CanIgnoreIfNotVisible() const
{
if (!AnimationUtils::IsOffscreenThrottlingEnabled()) {
return false;
}
// FIXME (bug 1303235): We don't calculate mCumulativeChangeHint for
// the Servo backend yet
- nsPresContext* presContext = GetPresContext();
- if (!presContext || presContext->StyleSet()->IsServo()) {
+ if (mDocument->IsStyledByServo()) {
return false;
}
// FIXME: For further sophisticated optimization we need to check
// change hint on the segment corresponding to computedTiming.progress.
return NS_IsHintSubset(
mCumulativeChangeHint, nsChangeHint_Hints_CanIgnoreIfNotVisible);
}