Bug 1344598 - Use nsIDocument::IsStyledByServo to check we are using servo or not. r=boris
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Mon, 06 Mar 2017 11:42:57 +0900
changeset 345987 26cf91f36f5ea3b6f40802b6542d4a37c0848ad4
parent 345986 f79d9ed6303b3af16d4fb7025ba3c97a3f6e4cc2
child 345988 911024a9cf3c072f0e11bf5f6dafce3db07bd881
push id31451
push usercbook@mozilla.com
push dateMon, 06 Mar 2017 09:52:09 +0000
treeherdermozilla-central@7099e03837e8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersboris
bugs1344598
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1344598 - Use nsIDocument::IsStyledByServo to check we are using servo or not. r=boris MozReview-Commit-ID: 1yQUAwHy51
dom/animation/KeyframeEffectReadOnly.cpp
--- 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);
 }