Bug 1311257 - Support missing keyframes handling for stylo. r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Thu, 06 Apr 2017 10:34:51 +0900
changeset 556569 26c07604e112a27531570bbf3fd809ae1ae45ce8
parent 556568 6e26f1db3e7cdb771558a61c2ea985e6ed87264e
child 556570 3a645d8c0dc223cb6c2d9d0434409ae324c73f18
push id52584
push userhikezoe@mozilla.com
push dateThu, 06 Apr 2017 03:01:12 +0000
reviewersbirtles
bugs1311257
milestone55.0a1
Bug 1311257 - Support missing keyframes handling for stylo. r?birtles MozReview-Commit-ID: 1Iz6By2Y2Gp
dom/animation/KeyframeEffectReadOnly.cpp
dom/animation/KeyframeUtils.cpp
--- a/dom/animation/KeyframeEffectReadOnly.cpp
+++ b/dom/animation/KeyframeEffectReadOnly.cpp
@@ -434,21 +434,17 @@ KeyframeEffectReadOnly::GetUnderlyingSty
 StyleAnimationValue
 KeyframeEffectReadOnly::CompositeValue(
   nsCSSPropertyID aProperty,
   const RefPtr<AnimValuesStyleRule>& aAnimationRule,
   const StyleAnimationValue& aValueToComposite,
   CompositeOperation aCompositeOperation)
 {
   MOZ_ASSERT(mTarget, "CompositeValue should be called with target element");
-
-  // FIXME: Bug 1311257: Get the base value for the servo backend.
-  if (mDocument->IsStyledByServo()) {
-    return aValueToComposite;
-  }
+  MOZ_ASSERT(!mDocument->IsStyledByServo());
 
   StyleAnimationValue underlyingValue =
     GetUnderlyingStyle(aProperty, aAnimationRule);
 
   return CompositeValue(aProperty,
                         aValueToComposite,
                         underlyingValue,
                         aCompositeOperation);
@@ -667,23 +663,16 @@ KeyframeEffectReadOnly::ComposeStyleRule
   const RawServoAnimationValueMap& aAnimationValues,
   const AnimationProperty& aProperty,
   const AnimationPropertySegment& aSegment,
   const ComputedTiming& aComputedTiming)
 {
   // Bug 1329878 - Stylo: Implement accumulate and addition on Servo
   // AnimationValue.
 
-  // For unsupported or non-animatable animation types, we get nullptrs.
-  if (!aSegment.mFromValue.mServo|| !aSegment.mToValue.mServo) {
-    NS_ERROR("Compose style for unsupported or non-animatable property, "
-             "so get invalid RawServoAnimationValues");
-    return;
-  }
-
   Servo_AnimationCompose(&aAnimationValues,
                          &mBaseStyleValuesForServo,
                          aProperty.mProperty,
                          &aSegment,
                          &aComputedTiming);
 }
 
 template<typename ComposeAnimationResult>
--- a/dom/animation/KeyframeUtils.cpp
+++ b/dom/animation/KeyframeUtils.cpp
@@ -464,19 +464,17 @@ KeyframeUtils::GetKeyframesFromObject(JS
   }
 
   if (aRv.Failed()) {
     MOZ_ASSERT(keyframes.IsEmpty(),
                "Should not set any keyframes when there is an error");
     return keyframes;
   }
 
-  // FIXME: Bug 1311257: Support missing keyframes for Servo backend.
-  if ((!AnimationUtils::IsCoreAPIEnabled() ||
-       aDocument->IsStyledByServo()) &&
+  if (!AnimationUtils::IsCoreAPIEnabled() &&
       RequiresAdditiveAnimation(keyframes, aDocument)) {
     keyframes.Clear();
     aRv.Throw(NS_ERROR_DOM_ANIM_MISSING_PROPS_ERR);
   }
 
   return keyframes;
 }
 
@@ -1439,33 +1437,30 @@ GetKeyframeListFromPropertyIndexedKeyfra
   JS::Rooted<JSObject*> object(aCx, &aValue.toObject());
   nsTArray<PropertyValuesPair> propertyValuesPairs;
   if (!GetPropertyValuesPairs(aCx, object, ListAllowance::eAllow,
                               propertyValuesPairs)) {
     aRv.Throw(NS_ERROR_FAILURE);
     return;
   }
 
-  bool isServoBackend = aDocument->IsStyledByServo();
-
   // Create a set of keyframes for each property.
   nsCSSParser parser(aDocument->CSSLoader());
   nsClassHashtable<nsFloatHashKey, Keyframe> processedKeyframes;
   for (const PropertyValuesPair& pair : propertyValuesPairs) {
     size_t count = pair.mValues.Length();
     if (count == 0) {
       // No animation values for this property.
       continue;
     }
 
     // If we only have one value, we should animate from the underlying value
     // using additive animation--however, we don't support additive animation
-    // for Servo backend (bug 1311257) or when the core animation API pref is
-    // switched off.
-    if ((!AnimationUtils::IsCoreAPIEnabled() || isServoBackend) &&
+    // when the core animation API pref is switched off.
+    if ((!AnimationUtils::IsCoreAPIEnabled()) &&
         count == 1) {
       aRv.Throw(NS_ERROR_DOM_ANIM_MISSING_PROPS_ERR);
       return;
     }
 
     size_t n = pair.mValues.Length() - 1;
     size_t i = 0;