Bug 1302949 - Skip calling CalculateCumulativeChangeHint draft
authorBrian Birtles <birtles@gmail.com>
Fri, 16 Sep 2016 11:35:59 +0900
changeset 421003 c0330b104afb4b970569c0cb650315e633b7e796
parent 421002 570ed28437ecaa22ac7571a9b47388e8abd0cb96
child 532941 7a00a8f5040619e6412c3aa603d241e0f71aa96f
push id31345
push userbbirtles@mozilla.com
push dateWed, 05 Oct 2016 02:47:30 +0000
bugs1302949
milestone52.0a1
Bug 1302949 - Skip calling CalculateCumulativeChangeHint There are a few pieces missing before we can do this with Servo. Since this only enables an optimization for off-screen animations we should skip this for now so it doesn't block animations from running. MozReview-Commit-ID: GecHWQZYxpK
dom/animation/KeyframeEffectReadOnly.cpp
--- a/dom/animation/KeyframeEffectReadOnly.cpp
+++ b/dom/animation/KeyframeEffectReadOnly.cpp
@@ -291,17 +291,20 @@ KeyframeEffectReadOnly::UpdateProperties
 
   for (AnimationProperty& property : mProperties) {
     property.mWinsInCascade =
       winningInCascadeProperties.HasProperty(property.mProperty);
     property.mIsRunningOnCompositor =
       runningOnCompositorProperties.HasProperty(property.mProperty);
   }
 
-  CalculateCumulativeChangeHint(aStyleContext);
+  // FIXME (bug 1303235): Do this for Servo too
+  if (aStyleContext->PresContext()->StyleSet()->IsGecko()) {
+    CalculateCumulativeChangeHint(aStyleContext);
+  }
 
   MarkCascadeNeedsUpdate();
 
   RequestRestyle(EffectCompositor::RestyleType::Layer);
 }
 
 void
 KeyframeEffectReadOnly::ComposeStyle(RefPtr<AnimValuesStyleRule>& aStyleRule,
@@ -1270,16 +1273,23 @@ KeyframeEffectReadOnly::SetAnimation(Ani
 
 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()) {
+    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);
 }
 
 void
 KeyframeEffectReadOnly::MaybeUpdateFrameForCompositor()