Bug 1319336 - Add some assertions and early returns to animation code to make stylo tests progress further. r=birtles
authorCameron McCormack <cam@mcc.id.au>
Thu, 24 Nov 2016 12:45:51 +0800
changeset 324045 d867784dbea4d023c43b94c92d47f965777ae367
parent 324044 83f951d60fc77f37d94f16926762dd5ed58b3494
child 324046 880e9106f46dcb7d915358143e78574a7c0a1e3e
push id84306
push usercmccormack@mozilla.com
push dateThu, 24 Nov 2016 04:46:05 +0000
treeherdermozilla-inbound@d867784dbea4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbirtles
bugs1319336
milestone53.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 1319336 - Add some assertions and early returns to animation code to make stylo tests progress further. r=birtles MozReview-Commit-ID: 14rghu0zYG1
dom/animation/EffectCompositor.cpp
dom/smil/nsSMILAnimationController.cpp
layout/style/StyleAnimationValue.cpp
--- a/dom/animation/EffectCompositor.cpp
+++ b/dom/animation/EffectCompositor.cpp
@@ -81,16 +81,21 @@ FindAnimationsForCompositor(const nsIFra
       effects->PropertiesForAnimationsLevel().HasProperty(aProperty)) {
     return false;
   }
 
   if (aFrame->RefusedAsyncAnimation()) {
     return false;
   }
 
+  if (aFrame->StyleContext()->StyleSource().IsServoComputedValues()) {
+    NS_ERROR("stylo: cannot handle compositor-driven animations yet");
+    return false;
+  }
+
   // The animation cascade will almost always be up-to-date by this point
   // but there are some cases such as when we are restoring the refresh driver
   // from test control after seeking where it might not be the case.
   //
   // Those cases are probably not important but just to be safe, let's make
   // sure the cascade is up to date since if it *is* up to date, this is
   // basically a no-op.
   Maybe<NonOwningAnimationTarget> pseudoElement =
@@ -198,19 +203,21 @@ EffectCompositor::RequestRestyle(dom::El
     if (!hasPendingRestyle) {
       PostRestyleForAnimation(aElement, aPseudoType, aCascadeLevel);
     }
     elementsToRestyle.Put(key, true);
   }
 
   if (aRestyleType == RestyleType::Layer) {
     // Prompt layers to re-sync their animations.
-    MOZ_ASSERT(mPresContext->RestyleManager()->IsGecko(),
-               "stylo: Servo-backed style system should not be using "
+    if (mPresContext->RestyleManager()->IsServo()) {
+      NS_ERROR("stylo: Servo-backed style system should not be using "
                "EffectCompositor");
+      return;
+    }
     mPresContext->RestyleManager()->AsGecko()->IncrementAnimationGeneration();
     EffectSet* effectSet =
       EffectSet::GetEffectSet(aElement, aPseudoType);
     if (effectSet) {
       effectSet->UpdateAnimationGeneration(mPresContext);
     }
   }
 }
--- a/dom/smil/nsSMILAnimationController.cpp
+++ b/dom/smil/nsSMILAnimationController.cpp
@@ -316,16 +316,22 @@ nsSMILAnimationController::DoSample(bool
   }
   if (mRunningSample) {
     NS_ERROR("Shouldn't be recursively sampling");
     return;
   }
 
   bool isStyleFlushNeeded = mResampleNeeded;
   mResampleNeeded = false;
+
+  if (mDocument->IsStyledByServo()) {
+    NS_ERROR("stylo: SMIL animations not supported yet");
+    return;
+  }
+
   // Set running sample flag -- do this before flushing styles so that when we
   // flush styles we don't end up requesting extra samples
   AutoRestore<bool> autoRestoreRunningSample(mRunningSample);
   mRunningSample = true;
 
   // STEP 1: Bring model up to date
   // (i)  Rewind elements where necessary
   // (ii) Run milestone samples
--- a/layout/style/StyleAnimationValue.cpp
+++ b/layout/style/StyleAnimationValue.cpp
@@ -4646,16 +4646,20 @@ StyleAnimationValue::ExtractComputedValu
     }
     case eStyleAnimType_Discrete: {
       if (aProperty == eCSSProperty_visibility) {
         aComputedValue.SetIntValue(
           static_cast<const nsStyleVisibility*>(styleStruct)->mVisible,
           eUnit_Visibility);
         return true;
       }
+      if (aStyleContext->StyleSource().IsServoComputedValues()) {
+        NS_ERROR("stylo: extracting discretely animated values not supported");
+        return false;
+      }
       auto cssValue = MakeUnique<nsCSSValue>(eCSSUnit_Unset);
       aStyleContext->RuleNode()->GetDiscretelyAnimatedCSSValue(aProperty,
                                                                cssValue.get());
       aComputedValue.SetAndAdoptCSSValueValue(cssValue.release(),
                                               eUnit_DiscreteCSSValue);
       return true;
     }
     case eStyleAnimType_None: