Bug 1324691 - Part 1: Use warnings instead of assertions for unsupported OMTA. draft
authorBoris Chiou <boris.chiou@gmail.com>
Thu, 26 Jan 2017 15:27:44 +0800
changeset 467191 e5db69d2c0467cf1629a945ef10097e3f4586425
parent 467095 1e0e193b0812f68a12fbd69198552af62347af1e
child 467192 12f1364c9458ba311fb615c1a1f12acfaca7a535
push id43119
push userbmo:boris.chiou@gmail.com
push dateFri, 27 Jan 2017 10:05:05 +0000
bugs1324691
milestone54.0a1
Bug 1324691 - Part 1: Use warnings instead of assertions for unsupported OMTA. Make FindAnimationsForCompositor return false because we don't support OMTA, and use warnings, instead of assertions, because animations sill work. We call RequestRestyle(Layer) not only for OMTA but also for non-compositor-driven animations, so just skip the animation generation part, and use warnings, instead of assertions. MozReview-Commit-ID: LNw5aC8jOvh
dom/animation/EffectCompositor.cpp
--- a/dom/animation/EffectCompositor.cpp
+++ b/dom/animation/EffectCompositor.cpp
@@ -120,16 +120,23 @@ FindAnimationsForCompositor(const nsIFra
   MOZ_ASSERT(!aMatches || aMatches->IsEmpty(),
              "Matches array, if provided, should be empty");
 
   EffectSet* effects = EffectSet::GetEffectSet(aFrame);
   if (!effects || effects->IsEmpty()) {
     return false;
   }
 
+  // FIXME: Bug 1334036: stylo: Implement off-main-thread animations.
+  if (aFrame->StyleContext()->StyleSource().IsServoComputedValues()) {
+    NS_WARNING("stylo: return false in FindAnimationsForCompositor because "
+               "haven't supported compositor-driven animations yet");
+    return false;
+  }
+
   // First check for newly-started transform animations that should be
   // synchronized with geometric animations. We need to do this before any
   // other early returns (the one above is ok) since we can only check this
   // state when the animation is newly-started.
   if (aProperty == eCSSProperty_transform) {
     PendingAnimationTracker* tracker =
       aFrame->PresContext()->Document()->GetPendingAnimationTracker();
     if (tracker) {
@@ -144,21 +151,16 @@ 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 =
@@ -268,24 +270,24 @@ EffectCompositor::RequestRestyle(dom::El
     bool hasPendingRestyle = elementsToRestyle.Get(key);
     if (!hasPendingRestyle) {
       PostRestyleForAnimation(aElement, aPseudoType, aCascadeLevel);
     }
     elementsToRestyle.Put(key, true);
   }
 
   if (aRestyleType == RestyleType::Layer) {
-    // FIXME: we call RequestRestyle for both stylo and gecko, so we
-    // should fix this after supporting animations on the compositor.
-    // Prompt layers to re-sync their animations.
+    // FIXME: Bug 1334036: we call RequestRestyle for both stylo and gecko,
+    // so we should fix this after supporting animations on the compositor.
     if (mPresContext->RestyleManager()->IsServo()) {
-      NS_ERROR("stylo: Servo-backed style system should not be using "
-               "EffectCompositor");
+      NS_WARNING("stylo: RequestRestyle to layer, but Servo-backed style "
+                 "system haven't supported compositor-driven animations yet");
       return;
     }
+    // Prompt layers to re-sync their animations.
     mPresContext->RestyleManager()->AsGecko()->IncrementAnimationGeneration();
     EffectSet* effectSet =
       EffectSet::GetEffectSet(aElement, aPseudoType);
     if (effectSet) {
       effectSet->UpdateAnimationGeneration(mPresContext);
     }
   }
 }