Bug 1338927 - Part 8: Drop Servo_AnimationValues_Populate. r=birtles
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Thu, 23 Feb 2017 09:52:44 +0900
changeset 373739 ab163e43086d259dc6b9884707987a043a4308db
parent 373738 e1584055718cd2188a50bc218f2e07496028cb7b
child 373740 42f0a217197da34ca4371b8f3aa32dc06249f520
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbirtles
bugs1338927
milestone54.0a1
Bug 1338927 - Part 8: Drop Servo_AnimationValues_Populate. r=birtles MozReview-Commit-ID: 83WCbKL35h
dom/animation/KeyframeUtils.cpp
layout/style/ServoBindingList.h
--- a/dom/animation/KeyframeUtils.cpp
+++ b/dom/animation/KeyframeUtils.cpp
@@ -619,91 +619,55 @@ KeyframeUtils::GetComputedKeyframeValues
 /* static */ nsTArray<ComputedKeyframeValues>
 KeyframeUtils::GetComputedKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
                                          dom::Element* aElement,
                                          nsStyleContext* aStyleContext)
 {
   MOZ_ASSERT(aStyleContext);
   MOZ_ASSERT(aElement);
 
-  StyleBackendType styleBackend = aElement->OwnerDoc()->GetStyleBackendType();
-
   const size_t len = aKeyframes.Length();
   nsTArray<ComputedKeyframeValues> result(len);
 
-  const ServoComputedValues* currentStyle = nullptr;
-  const ServoComputedValues* parentStyle = nullptr;
-
-  if (styleBackend == StyleBackendType::Servo) {
-    currentStyle = aStyleContext->StyleSource().AsServoComputedValues();
-    if (aStyleContext->GetParent()) {
-      parentStyle = aStyleContext->GetParent()->StyleSource().AsServoComputedValues();
-    }
-  }
-
   for (const Keyframe& frame : aKeyframes) {
     nsCSSPropertyIDSet propertiesOnThisKeyframe;
     ComputedKeyframeValues* computedValues = result.AppendElement();
     for (const PropertyValuePair& pair :
            PropertyPriorityIterator(frame.mPropertyValues)) {
-      MOZ_ASSERT(!pair.mServoDeclarationBlock ||
-                 styleBackend == StyleBackendType::Servo,
+      MOZ_ASSERT(!pair.mServoDeclarationBlock,
                  "Animation values were parsed using Servo backend but target"
                  " element is not using Servo backend?");
 
-      if (IsInvalidValuePair(pair, styleBackend)) {
+      if (IsInvalidValuePair(pair, StyleBackendType::Gecko)) {
         continue;
       }
 
       // Expand each value into the set of longhands and produce
       // a KeyframeValueEntry for each value.
       nsTArray<PropertyStyleAnimationValuePair> values;
 
-      if (styleBackend == StyleBackendType::Servo) {
-        if (nsCSSProps::IsShorthand(pair.mProperty)) {
-          CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(p, pair.mProperty,
-                                               CSSEnabledState::eForAllContent) {
-            if (nsCSSProps::kAnimTypeTable[*p] == eStyleAnimType_None) {
-              // Skip non-animatable component longhands.
-              continue;
-            }
-            PropertyStyleAnimationValuePair* valuePair = values.AppendElement();
-            valuePair->mProperty = *p;
-          }
-        } else {
-          PropertyStyleAnimationValuePair* valuePair = values.AppendElement();
-          valuePair->mProperty = pair.mProperty;
+      // For shorthands, we store the string as a token stream so we need to
+      // extract that first.
+      if (nsCSSProps::IsShorthand(pair.mProperty)) {
+        nsCSSValueTokenStream* tokenStream = pair.mValue.GetTokenStreamValue();
+        if (!StyleAnimationValue::ComputeValues(pair.mProperty,
+              CSSEnabledState::eForAllContent, aElement, aStyleContext,
+              tokenStream->mTokenStream, /* aUseSVGMode */ false, values) ||
+            IsComputeValuesFailureKey(pair)) {
+          continue;
         }
-
-        Servo_AnimationValues_Populate(&values,
-                                       pair.mServoDeclarationBlock,
-                                       currentStyle,
-                                       parentStyle,
-                                       aStyleContext->PresContext());
       } else {
-        // For shorthands, we store the string as a token stream so we need to
-        // extract that first.
-        if (nsCSSProps::IsShorthand(pair.mProperty)) {
-          nsCSSValueTokenStream* tokenStream = pair.mValue.GetTokenStreamValue();
-          if (!StyleAnimationValue::ComputeValues(pair.mProperty,
-                CSSEnabledState::eForAllContent, aElement, aStyleContext,
-                tokenStream->mTokenStream, /* aUseSVGMode */ false, values) ||
-              IsComputeValuesFailureKey(pair)) {
-            continue;
-          }
-        } else {
-          if (!StyleAnimationValue::ComputeValues(pair.mProperty,
-                CSSEnabledState::eForAllContent, aElement, aStyleContext,
-                pair.mValue, /* aUseSVGMode */ false, values)) {
-            continue;
-          }
-          MOZ_ASSERT(values.Length() == 1,
-                    "Longhand properties should produce a single"
-                    " StyleAnimationValue");
+        if (!StyleAnimationValue::ComputeValues(pair.mProperty,
+              CSSEnabledState::eForAllContent, aElement, aStyleContext,
+              pair.mValue, /* aUseSVGMode */ false, values)) {
+          continue;
         }
+        MOZ_ASSERT(values.Length() == 1,
+                  "Longhand properties should produce a single"
+                  " StyleAnimationValue");
       }
 
       for (auto& value : values) {
         // If we already got a value for this property on the keyframe,
         // skip this one.
         if (propertiesOnThisKeyframe.HasProperty(value.mProperty)) {
           continue;
         }
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -108,22 +108,16 @@ SERVO_BINDING_FUNC(Servo_ParseProperty,
 SERVO_BINDING_FUNC(Servo_GetComputedKeyframeValues, void,
                    RawGeckoKeyframeListBorrowed keyframes,
                    ServoComputedValuesBorrowed style,
                    ServoComputedValuesBorrowedOrNull parent_style,
                    RawGeckoPresContextBorrowed pres_context,
                    RawGeckoComputedKeyframeValuesListBorrowedMut result)
 
 // AnimationValues handling
-SERVO_BINDING_FUNC(Servo_AnimationValues_Populate, void,
-                   RawGeckoAnimationValueListBorrowedMut,
-                   RawServoDeclarationBlockBorrowed,
-                   ServoComputedValuesBorrowed,
-                   ServoComputedValuesBorrowedOrNull,
-                   RawGeckoPresContextBorrowed)
 SERVO_BINDING_FUNC(Servo_AnimationValues_Interpolate,
                    RawServoAnimationValueStrong,
                    RawServoAnimationValueBorrowed from,
                    RawServoAnimationValueBorrowed to,
                    double progress)
 SERVO_BINDING_FUNC(Servo_AnimationValues_Uncompute,
                    RawServoDeclarationBlockStrong,
                    RawServoAnimationValueBorrowedListBorrowed value)