Bug 1245748 - Remove no-longer-needed code for directly setting up properties in KeyframeEffect(ReadOnly) constructor; r=heycam
authorBrian Birtles <birtles@gmail.com>
Tue, 22 Mar 2016 16:36:45 +0900
changeset 290215 5dbdbe3e4655a385663f25b7e16f85fbcf5f9207
parent 290214 88795391fe8b748c6aa1d7493733aa8c49a9c5c7
child 290216 5081a75fbe8ccff1139853dbea6aeb92bd6fdc9d
push id30114
push usercbook@mozilla.com
push dateThu, 24 Mar 2016 15:15:54 +0000
treeherdermozilla-central@24c5fbde4488 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1245748
milestone48.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 1245748 - Remove no-longer-needed code for directly setting up properties in KeyframeEffect(ReadOnly) constructor; r=heycam MozReview-Commit-ID: 4V3LMByas9Q
dom/animation/KeyframeUtils.cpp
dom/animation/KeyframeUtils.h
--- a/dom/animation/KeyframeUtils.cpp
+++ b/dom/animation/KeyframeUtils.cpp
@@ -16,21 +16,16 @@
 #include "jsapi.h" // For ForOfIterator etc.
 #include "nsClassHashtable.h"
 #include "nsCSSParser.h"
 #include "nsCSSProps.h"
 #include "nsCSSPseudoElements.h" // For CSSPseudoElementType
 #include "nsTArray.h"
 #include <algorithm> // For std::stable_sort
 
-// TODO: Remove once we drop LookupStyleContext
-#include "nsComputedDOMStyle.h"
-#include "nsIDocument.h"
-#include "nsIPresShell.h"
-
 namespace mozilla {
 
 // ------------------------------------------------------------------
 //
 // Internal data types
 //
 // ------------------------------------------------------------------
 
@@ -227,27 +222,16 @@ struct PropertyValuesPair
 {
   nsCSSProperty mProperty;
   nsTArray<nsString> mValues;
 
   typedef TPropertyPriorityComparator<PropertyValuesPair> Comparator;
 };
 
 /**
- * The result of parsing a JS object as a BaseKeyframe dictionary
- * and getting its property-value pairs from its open-ended
- * properties.
- */
-struct OffsetIndexedKeyframe
-{
-  dom::binding_detail::FastBaseKeyframe mKeyframeDict;
-  nsTArray<PropertyValuesPair> mPropertyValuePairs;
-};
-
-/**
  * An additional property (for a property-values pair) found on a
  * BaseKeyframe or BasePropertyIndexedKeyframe object.
  */
 struct AdditionalProperty
 {
   nsCSSProperty mProperty;
   size_t mJsidIndex;        // Index into |ids| in GetPropertyValuesPairs.
 
@@ -263,34 +247,26 @@ struct AdditionalProperty
     {
       return nsCSSProps::PropertyIDLNameSortPosition(aLhs.mProperty) <
              nsCSSProps::PropertyIDLNameSortPosition(aRhs.mProperty);
     }
   };
 };
 
 /**
- * A property and StyleAnimationValue pair.
+ * Data for a segment in a keyframe animation of a given property
+ * whose value is a StyleAnimationValue.
+ *
+ * KeyframeValueEntry is used in GetAnimationPropertiesFromKeyframes
+ * to gather data for each individual segment.
  */
-struct KeyframeValue
+struct KeyframeValueEntry
 {
   nsCSSProperty mProperty;
   StyleAnimationValue mValue;
-};
-
-/**
- * Data for a segment in a keyframe animation of a given property
- * whose value is a StyleAnimationValue.
- *
- * KeyframeValueEntry is used in BuildAnimationPropertyListFromKeyframeSequence
- * to gather data for each individual segment described by an author-supplied
- * an IDL sequence<Keyframe> value so that they can be parsed into mProperties.
- */
-struct KeyframeValueEntry : KeyframeValue
-{
   float mOffset;
   Maybe<ComputedTimingFunction> mTimingFunction;
 
   struct PropertyOffsetComparator
   {
     static bool Equals(const KeyframeValueEntry& aLhs,
                        const KeyframeValueEntry& aRhs)
     {
@@ -330,38 +306,24 @@ public:
 
 // ------------------------------------------------------------------
 //
 // Internal helper method declarations
 //
 // ------------------------------------------------------------------
 
 static void
-BuildAnimationPropertyListFromKeyframeSequence(
-    JSContext* aCx,
-    Element* aTarget,
-    CSSPseudoElementType aPseudoType,
-    JS::ForOfIterator& aIterator,
-    nsTArray<AnimationProperty>& aResult,
-    ErrorResult& aRv);
-
-static void
 GetKeyframeListFromKeyframeSequence(JSContext* aCx,
                                     JS::ForOfIterator& aIterator,
                                     nsTArray<Keyframe>& aResult,
                                     ErrorResult& aRv);
 
 static bool
 ConvertKeyframeSequence(JSContext* aCx,
                         JS::ForOfIterator& aIterator,
-                        nsTArray<OffsetIndexedKeyframe>& aResult);
-
-static bool
-ConvertKeyframeSequence(JSContext* aCx,
-                        JS::ForOfIterator& aIterator,
                         nsTArray<Keyframe>& aResult);
 
 static bool
 GetPropertyValuesPairs(JSContext* aCx,
                        JS::Handle<JSObject*> aObject,
                        ListAllowance aAllowLists,
                        nsTArray<PropertyValuesPair>& aResult);
 
@@ -376,113 +338,39 @@ AppendValueAsString(JSContext* aCx,
                     nsTArray<nsString>& aValues,
                     JS::Handle<JS::Value> aValue);
 
 static PropertyValuePair
 MakePropertyValuePair(nsCSSProperty aProperty, const nsAString& aStringValue,
                       nsCSSParser& aParser, nsIDocument* aDocument);
 
 static bool
-HasValidOffsets(const nsTArray<OffsetIndexedKeyframe>& aKeyframes);
-
-static bool
 HasValidOffsets(const nsTArray<Keyframe>& aKeyframes);
 
 static void
-ApplyDistributeSpacing(nsTArray<OffsetIndexedKeyframe>& aKeyframes);
-
-static void
-GenerateValueEntries(Element* aTarget,
-                     CSSPseudoElementType aPseudoType,
-                     nsTArray<OffsetIndexedKeyframe>& aKeyframes,
-                     nsTArray<KeyframeValueEntry>& aResult,
-                     ErrorResult& aRv);
-
-static void
 BuildSegmentsFromValueEntries(nsTArray<KeyframeValueEntry>& aEntries,
                               nsTArray<AnimationProperty>& aResult);
 
 static void
-BuildAnimationPropertyListFromPropertyIndexedKeyframes(
-    JSContext* aCx,
-    Element* aTarget,
-    CSSPseudoElementType aPseudoType,
-    JS::Handle<JS::Value> aValue,
-    InfallibleTArray<AnimationProperty>& aResult,
-    ErrorResult& aRv);
-
-static void
 GetKeyframeListFromPropertyIndexedKeyframe(JSContext* aCx,
                                            JS::Handle<JS::Value> aValue,
                                            nsTArray<Keyframe>& aResult,
                                            ErrorResult& aRv);
 
 static bool
 RequiresAdditiveAnimation(const nsTArray<Keyframe>& aKeyframes,
                           nsIDocument* aDocument);
 
 
-// TODO: This is only temporary until we remove the call sites for this.
-already_AddRefed<nsStyleContext>
-LookupStyleContext(dom::Element* aElement, CSSPseudoElementType aPseudoType);
-
 // ------------------------------------------------------------------
 //
 // Public API
 //
 // ------------------------------------------------------------------
 
-/* static */ void
-KeyframeUtils::BuildAnimationPropertyList(
-    JSContext* aCx,
-    Element* aTarget,
-    CSSPseudoElementType aPseudoType,
-    JS::Handle<JSObject*> aFrames,
-    InfallibleTArray<AnimationProperty>& aResult,
-    ErrorResult& aRv)
-{
-  MOZ_ASSERT(aResult.IsEmpty());
-
-  // See the description of frame lists in the spec:
-  //
-  // https://w3c.github.io/web-animations/#processing-a-frames-argument
-  //
-  // We don't support SharedKeyframeList yet, but we do support the other
-  // types of arguments.  We manually implement the parts of JS-to-IDL union
-  // conversion algorithm from the Web IDL spec, since we have to represent
-  // this as an object? so we can look at the open-ended set of properties
-  // on these objects.
-
-  if (!aFrames) {
-    // The argument was explicitly null.  In this case, the default dictionary
-    // value for PropertyIndexedKeyframe would result in no keyframes.
-    return;
-  }
-
-  // At this point we know we have an object.  We try to convert it to a
-  // sequence<Keyframe> first, and if that fails due to not being iterable,
-  // we try to convert it to PropertyIndexedKeyframe.
-  JS::Rooted<JS::Value> objectValue(aCx, JS::ObjectValue(*aFrames));
-  JS::ForOfIterator iter(aCx);
-  if (!iter.init(objectValue, JS::ForOfIterator::AllowNonIterable)) {
-    aRv.Throw(NS_ERROR_FAILURE);
-    return;
-  }
-
-  if (iter.valueIsIterable()) {
-    BuildAnimationPropertyListFromKeyframeSequence(aCx, aTarget, aPseudoType,
-                                                   iter, aResult, aRv);
-  } else {
-    BuildAnimationPropertyListFromPropertyIndexedKeyframes(aCx, aTarget,
-                                                           aPseudoType,
-                                                           objectValue, aResult,
-                                                           aRv);
-  }
-}
-
 /* static */ nsTArray<Keyframe>
 KeyframeUtils::GetKeyframesFromObject(JSContext* aCx,
                                       JS::Handle<JSObject*> aFrames,
                                       ErrorResult& aRv)
 {
   MOZ_ASSERT(!aRv.Failed());
 
   nsTArray<Keyframe> keyframes;
@@ -656,75 +544,16 @@ KeyframeUtils::GetAnimationPropertiesFro
 
 // ------------------------------------------------------------------
 //
 // Internal helpers
 //
 // ------------------------------------------------------------------
 
 /**
- * Converts a JS object to an IDL sequence<Keyframe> and builds an
- * array of AnimationProperty objects for the keyframe animation
- * that it specifies.
- *
- * @param aTarget The target of the animation.
- * @param aIterator An already-initialized ForOfIterator for the JS
- *   object to iterate over as a sequence.
- * @param aResult The array into which the resulting AnimationProperty
- *   objects will be appended.
- */
-static void
-BuildAnimationPropertyListFromKeyframeSequence(
-    JSContext* aCx,
-    Element* aTarget,
-    CSSPseudoElementType aPseudoType,
-    JS::ForOfIterator& aIterator,
-    nsTArray<AnimationProperty>& aResult,
-    ErrorResult& aRv)
-{
-  // Convert the object in aIterator to sequence<Keyframe>, producing
-  // an array of OffsetIndexedKeyframe objects.
-  AutoTArray<OffsetIndexedKeyframe,4> keyframes;
-  if (!ConvertKeyframeSequence(aCx, aIterator, keyframes)) {
-    aRv.Throw(NS_ERROR_FAILURE);
-    return;
-  }
-
-  // If the sequence<> had zero elements, we won't generate any
-  // keyframes.
-  if (keyframes.IsEmpty()) {
-    return;
-  }
-
-  // Check that the keyframes are loosely sorted and with values all
-  // between 0% and 100%.
-  if (!HasValidOffsets(keyframes)) {
-    aRv.ThrowTypeError<dom::MSG_INVALID_KEYFRAME_OFFSETS>();
-    return;
-  }
-
-  // Fill in 0%/100% values if the first/element keyframes don't have
-  // a specified offset, and evenly space those that have a missing
-  // offset.  (We don't support paced spacing yet.)
-  ApplyDistributeSpacing(keyframes);
-
-  // Convert the OffsetIndexedKeyframes into a list of KeyframeValueEntry
-  // objects.
-  nsTArray<KeyframeValueEntry> entries;
-  GenerateValueEntries(aTarget, aPseudoType, keyframes, entries, aRv);
-  if (aRv.Failed()) {
-    return;
-  }
-
-  // Finally, build an array of AnimationProperty objects in aResult
-  // corresponding to the entries.
-  BuildSegmentsFromValueEntries(entries, aResult);
-}
-
-/**
  * Converts a JS object to an IDL sequence<Keyframe>.
  *
  * @param aCx The JSContext corresponding to |aIterator|.
  * @param aIterator An already-initialized ForOfIterator for the JS
  *   object to iterate over as a sequence.
  * @param aResult The array into which the resulting Keyframe objects will be
  *   appended.
  * @param aRv Out param to store any errors thrown by this function.
@@ -758,62 +587,16 @@ GetKeyframeListFromKeyframeSequence(JSCo
     aRv.ThrowTypeError<dom::MSG_INVALID_KEYFRAME_OFFSETS>();
     aResult.Clear();
     return;
   }
 }
 
 /**
  * Converts a JS object wrapped by the given JS::ForIfIterator to an
- * IDL sequence<Keyframe> and stores the resulting OffsetIndexedKeyframe
- * objects in aResult.
- */
-static bool
-ConvertKeyframeSequence(JSContext* aCx,
-                        JS::ForOfIterator& aIterator,
-                        nsTArray<OffsetIndexedKeyframe>& aResult)
-{
-  JS::Rooted<JS::Value> value(aCx);
-  for (;;) {
-    bool done;
-    if (!aIterator.next(&value, &done)) {
-      return false;
-    }
-    if (done) {
-      break;
-    }
-    // Each value found when iterating the object must be an object
-    // or null/undefined (which gets treated as a default {} dictionary
-    // value).
-    if (!value.isObject() && !value.isNullOrUndefined()) {
-      dom::ThrowErrorMessage(aCx, dom::MSG_NOT_OBJECT,
-                             "Element of sequence<Keyframes> argument");
-      return false;
-    }
-    // Convert the JS value into a BaseKeyframe dictionary value.
-    OffsetIndexedKeyframe* keyframe = aResult.AppendElement();
-    if (!keyframe->mKeyframeDict.Init(
-          aCx, value, "Element of sequence<Keyframes> argument")) {
-      return false;
-    }
-    // Look for additional property-values pairs on the object.
-    if (value.isObject()) {
-      JS::Rooted<JSObject*> object(aCx, &value.toObject());
-      if (!GetPropertyValuesPairs(aCx, object,
-                                  ListAllowance::eDisallow,
-                                  keyframe->mPropertyValuePairs)) {
-        return false;
-      }
-    }
-  }
-  return true;
-}
-
-/**
- * Converts a JS object wrapped by the given JS::ForIfIterator to an
  * IDL sequence<Keyframe> and stores the resulting Keyframe objects in
  * aResult.
  */
 static bool
 ConvertKeyframeSequence(JSContext* aCx,
                         JS::ForOfIterator& aIterator,
                         nsTArray<Keyframe>& aResult)
 {
@@ -1062,197 +845,32 @@ MakePropertyValuePair(nsCSSProperty aPro
  * Checks that the given keyframes are loosely ordered (each keyframe's
  * offset that is not null is greater than or equal to the previous
  * non-null offset) and that all values are within the range [0.0, 1.0].
  *
  * @return true if the keyframes' offsets are correctly ordered and
  *   within range; false otherwise.
  */
 static bool
-HasValidOffsets(const nsTArray<OffsetIndexedKeyframe>& aKeyframes)
-{
-  double offset = 0.0;
-  for (const OffsetIndexedKeyframe& keyframe : aKeyframes) {
-    if (!keyframe.mKeyframeDict.mOffset.IsNull()) {
-      double thisOffset = keyframe.mKeyframeDict.mOffset.Value();
-      if (thisOffset < offset || thisOffset > 1.0f) {
-        return false;
-      }
-      offset = thisOffset;
-    }
-  }
-  return true;
-}
-
-/**
- * Checks that the given keyframes are loosely ordered (each keyframe's
- * offset that is not null is greater than or equal to the previous
- * non-null offset) and that all values are within the range [0.0, 1.0].
- *
- * @return true if the keyframes' offsets are correctly ordered and
- *   within range; false otherwise.
- */
-static bool
 HasValidOffsets(const nsTArray<Keyframe>& aKeyframes)
 {
   double offset = 0.0;
   for (const Keyframe& keyframe : aKeyframes) {
     if (keyframe.mOffset) {
       double thisOffset = keyframe.mOffset.value();
       if (thisOffset < offset || thisOffset > 1.0f) {
         return false;
       }
       offset = thisOffset;
     }
   }
   return true;
 }
 
 /**
- * Fills in any null offsets for the given keyframes by applying the
- * "distribute" spacing algorithm.
- *
- * http://w3c.github.io/web-animations/#distribute-keyframe-spacing-mode
- */
-static void
-ApplyDistributeSpacing(nsTArray<OffsetIndexedKeyframe>& aKeyframes)
-{
-  // If the first or last keyframes have an unspecified offset,
-  // fill them in with 0% and 100%.  If there is only a single keyframe,
-  // then it gets 100%.
-  if (aKeyframes.LastElement().mKeyframeDict.mOffset.IsNull()) {
-    aKeyframes.LastElement().mKeyframeDict.mOffset.SetValue(1.0);
-  }
-  if (aKeyframes[0].mKeyframeDict.mOffset.IsNull()) {
-    aKeyframes[0].mKeyframeDict.mOffset.SetValue(0.0);
-  }
-
-  // Fill in remaining missing offsets.
-  size_t i = 0;
-  while (i < aKeyframes.Length() - 1) {
-    MOZ_ASSERT(!aKeyframes[i].mKeyframeDict.mOffset.IsNull());
-    double start = aKeyframes[i].mKeyframeDict.mOffset.Value();
-    size_t j = i + 1;
-    while (aKeyframes[j].mKeyframeDict.mOffset.IsNull()) {
-      ++j;
-    }
-    double end = aKeyframes[j].mKeyframeDict.mOffset.Value();
-    size_t n = j - i;
-    for (size_t k = 1; k < n; ++k) {
-      double offset = start + double(k) / n * (end - start);
-      aKeyframes[i + k].mKeyframeDict.mOffset.SetValue(offset);
-    }
-    i = j;
-  }
-}
-
-/**
- * Splits out each property's keyframe animation segment information
- * from the OffsetIndexedKeyframe objects into an array of KeyframeValueEntry.
- *
- * The easing string value in OffsetIndexedKeyframe objects is parsed
- * into a ComputedTimingFunction value in the corresponding KeyframeValueEntry
- * objects.
- *
- * @param aTarget The target of the animation.
- * @param aPseudoType The pseudo type of the target if it is a pseudo element.
- * @param aKeyframes The keyframes to read.
- * @param aResult The array to append the resulting KeyframeValueEntry
- *   objects to.
- */
-static void
-GenerateValueEntries(Element* aTarget,
-                     CSSPseudoElementType aPseudoType,
-                     nsTArray<OffsetIndexedKeyframe>& aKeyframes,
-                     nsTArray<KeyframeValueEntry>& aResult,
-                     ErrorResult& aRv)
-{
-  RefPtr<nsStyleContext> styleContext =
-    LookupStyleContext(aTarget, aPseudoType);
-  if (!styleContext) {
-    aRv.Throw(NS_ERROR_FAILURE);
-    return;
-  }
-
-  nsCSSPropertySet properties;              // All properties encountered.
-  nsCSSPropertySet propertiesWithFromValue; // Those with a defined 0% value.
-  nsCSSPropertySet propertiesWithToValue;   // Those with a defined 100% value.
-
-  for (OffsetIndexedKeyframe& keyframe : aKeyframes) {
-    Maybe<ComputedTimingFunction> easing =
-      TimingParams::ParseEasing(keyframe.mKeyframeDict.mEasing,
-                                aTarget->OwnerDoc(), aRv);
-    if (aRv.Failed()) {
-      return;
-    }
-    float offset = float(keyframe.mKeyframeDict.mOffset.Value());
-    // We ignore keyframe.mKeyframeDict.mComposite since we don't support
-    // composite modes on keyframes yet.
-
-    // keyframe.mPropertyValuePairs is currently sorted by CSS property IDL
-    // name, since that was the order we read the properties from the JS
-    // object.  Re-sort the list so that longhand properties appear before
-    // shorthands, and with shorthands all appearing in increasing order of
-    // number of components.  For two longhand properties, or two shorthands
-    // with the same number of components, sort by IDL name.
-    //
-    // @see PropertyPriorityComparator.
-    keyframe.mPropertyValuePairs.Sort(PropertyValuesPair::Comparator());
-
-    nsCSSPropertySet propertiesOnThisKeyframe;
-    for (const PropertyValuesPair& pair : keyframe.mPropertyValuePairs) {
-      MOZ_ASSERT(pair.mValues.Length() == 1,
-                 "ConvertKeyframeSequence should have parsed single "
-                 "DOMString values from the property-values pairs");
-      // Parse the property's string value and produce a KeyframeValueEntry (or
-      // more than one, for shorthands) for it.
-      nsTArray<PropertyStyleAnimationValuePair> values;
-      if (StyleAnimationValue::ComputeValues(pair.mProperty,
-                                             nsCSSProps::eEnabledForAllContent,
-                                             aTarget,
-                                             styleContext,
-                                             pair.mValues[0],
-                                             /* aUseSVGMode */ false,
-                                             values)) {
-        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;
-          }
-
-          KeyframeValueEntry* entry = aResult.AppendElement();
-          entry->mOffset = offset;
-          entry->mProperty = value.mProperty;
-          entry->mValue = value.mValue;
-          entry->mTimingFunction = easing;
-
-          if (offset == 0.0) {
-            propertiesWithFromValue.AddProperty(value.mProperty);
-          } else if (offset == 1.0) {
-            propertiesWithToValue.AddProperty(value.mProperty);
-          }
-          propertiesOnThisKeyframe.AddProperty(value.mProperty);
-          properties.AddProperty(value.mProperty);
-        }
-      }
-    }
-  }
-
-  // We don't support additive segments and so can't support missing properties
-  // using their underlying value in 0% and 100% keyframes.  Throw an exception
-  // until we do support this.
-  if (!propertiesWithFromValue.Equals(properties) ||
-      !propertiesWithToValue.Equals(properties)) {
-    aRv.Throw(NS_ERROR_DOM_ANIM_MISSING_PROPS_ERR);
-    return;
-  }
-}
-
-/**
  * Builds an array of AnimationProperty objects to represent the keyframe
  * animation segments in aEntries.
  */
 static void
 BuildSegmentsFromValueEntries(nsTArray<KeyframeValueEntry>& aEntries,
                               nsTArray<AnimationProperty>& aResult)
 {
   if (aEntries.IsEmpty()) {
@@ -1343,193 +961,16 @@ BuildSegmentsFromValueEntries(nsTArray<K
     segment->mToValue   = aEntries[j].mValue;
     segment->mTimingFunction = aEntries[i].mTimingFunction;
 
     i = j;
   }
 }
 
 /**
- * Converts a JS object to an IDL PropertyIndexedKeyframe and builds an
- * array of AnimationProperty objects for the keyframe animation
- * that it specifies.
- *
- * @param aTarget The target of the animation.
- * @param aValue The JS object.
- * @param aResult The array into which the resulting AnimationProperty
- *   objects will be appended.
- */
-static void
-BuildAnimationPropertyListFromPropertyIndexedKeyframes(
-    JSContext* aCx,
-    Element* aTarget,
-    CSSPseudoElementType aPseudoType,
-    JS::Handle<JS::Value> aValue,
-    InfallibleTArray<AnimationProperty>& aResult,
-    ErrorResult& aRv)
-{
-  MOZ_ASSERT(aValue.isObject());
-
-  RefPtr<nsStyleContext> styleContext =
-    LookupStyleContext(aTarget, aPseudoType);
-  if (!styleContext) {
-    aRv.Throw(NS_ERROR_FAILURE);
-    return;
-  }
-
-  // Convert the object to a PropertyIndexedKeyframe dictionary to
-  // get its explicit dictionary members.
-  dom::binding_detail::FastBasePropertyIndexedKeyframe keyframes;
-  if (!keyframes.Init(aCx, aValue, "BasePropertyIndexedKeyframe argument",
-                      false)) {
-    aRv.Throw(NS_ERROR_FAILURE);
-    return;
-  }
-
-  Maybe<ComputedTimingFunction> easing =
-    TimingParams::ParseEasing(keyframes.mEasing, aTarget->OwnerDoc(), aRv);
-
-  // We ignore easing.mComposite since we don't support composite modes on
-  // keyframes yet.
-
-  // Get all the property--value-list pairs off the object.
-  JS::Rooted<JSObject*> object(aCx, &aValue.toObject());
-  nsTArray<PropertyValuesPair> propertyValuesPairs;
-  if (!GetPropertyValuesPairs(aCx, object, ListAllowance::eAllow,
-                              propertyValuesPairs)) {
-    aRv.Throw(NS_ERROR_FAILURE);
-    return;
-  }
-
-  // We must keep track of which properties we've already generated
-  // an AnimationProperty since the author could have specified both a
-  // shorthand and one of its component longhands on the
-  // PropertyIndexedKeyframe.
-  nsCSSPropertySet properties;
-
-  // Create AnimationProperty objects for each PropertyValuesPair, applying
-  // the "distribute" spacing algorithm to the segments.
-  for (const PropertyValuesPair& pair : propertyValuesPairs) {
-    size_t count = pair.mValues.Length();
-    if (count == 0) {
-      // No animation values for this property.
-      continue;
-    }
-    if (count == 1) {
-      // We don't support additive segments and so can't support an
-      // animation that goes from the underlying value to this
-      // specified value.  Throw an exception until we do support this.
-      aRv.Throw(NS_ERROR_DOM_ANIM_MISSING_PROPS_ERR);
-      return;
-    }
-
-    // If we find an invalid value, we don't create a segment for it, but
-    // we adjust the surrounding segments so that the timing of the segments
-    // is the same as if we did support it.  For example, animating with
-    // values ["red", "green", "yellow", "invalid", "blue"] will generate
-    // segments with this timing:
-    //
-    //   0.00 -> 0.25 : red -> green
-    //   0.25 -> 0.50 : green -> yellow
-    //   0.50 -> 1.00 : yellow -> blue
-    //
-    // With future spec clarifications we might decide to preserve the invalid
-    // value on the segment and make the animation code deal with the invalid
-    // value instead.
-    nsTArray<PropertyStyleAnimationValuePair> fromValues;
-    float fromKey = 0.0f;
-    if (!StyleAnimationValue::ComputeValues(pair.mProperty,
-                                            nsCSSProps::eEnabledForAllContent,
-                                            aTarget,
-                                            styleContext,
-                                            pair.mValues[0],
-                                            /* aUseSVGMode */ false,
-                                            fromValues)) {
-      // We need to throw for an invalid first value, since that would imply an
-      // additive animation, which we don't support yet.
-      aRv.Throw(NS_ERROR_DOM_ANIM_MISSING_PROPS_ERR);
-      return;
-    }
-
-    if (fromValues.IsEmpty()) {
-      // All longhand components of a shorthand pair.mProperty must be disabled.
-      continue;
-    }
-
-    // Create AnimationProperty objects for each property that had a
-    // value computed.  When pair.mProperty is a longhand, it is just
-    // that property.  When pair.mProperty is a shorthand, we'll have
-    // one property per longhand component.
-    nsTArray<size_t> animationPropertyIndexes;
-    animationPropertyIndexes.SetLength(fromValues.Length());
-    for (size_t i = 0, n = fromValues.Length(); i < n; ++i) {
-      nsCSSProperty p = fromValues[i].mProperty;
-      bool found = false;
-      if (properties.HasProperty(p)) {
-        // We have already dealt with this property.  Look up and
-        // overwrite the old AnimationProperty object.
-        for (size_t j = 0, m = aResult.Length(); j < m; ++j) {
-          if (aResult[j].mProperty == p) {
-            aResult[j].mSegments.Clear();
-            animationPropertyIndexes[i] = j;
-            found = true;
-            break;
-          }
-        }
-        MOZ_ASSERT(found, "properties is inconsistent with aResult");
-      }
-      if (!found) {
-        // This is the first time we've encountered this property.
-        animationPropertyIndexes[i] = aResult.Length();
-        AnimationProperty* animationProperty = aResult.AppendElement();
-        animationProperty->mProperty = p;
-        properties.AddProperty(p);
-      }
-    }
-
-    double portion = 1.0 / (count - 1);
-    for (size_t i = 0; i < count - 1; ++i) {
-      nsTArray<PropertyStyleAnimationValuePair> toValues;
-      float toKey = (i + 1) * portion;
-      if (!StyleAnimationValue::ComputeValues(pair.mProperty,
-                                              nsCSSProps::eEnabledForAllContent,
-                                              aTarget,
-                                              styleContext,
-                                              pair.mValues[i + 1],
-                                              /* aUseSVGMode */ false,
-                                              toValues)) {
-        if (i + 1 == count - 1) {
-          // We need to throw for an invalid last value, since that would
-          // imply an additive animation, which we don't support yet.
-          aRv.Throw(NS_ERROR_DOM_ANIM_MISSING_PROPS_ERR);
-          return;
-        }
-        // Otherwise, skip the segment.
-        continue;
-      }
-      MOZ_ASSERT(toValues.Length() == fromValues.Length(),
-                 "should get the same number of properties as the last time "
-                 "we called ComputeValues for pair.mProperty");
-      for (size_t j = 0, n = toValues.Length(); j < n; ++j) {
-        size_t index = animationPropertyIndexes[j];
-        AnimationPropertySegment* segment =
-          aResult[index].mSegments.AppendElement();
-        segment->mFromKey = fromKey;
-        segment->mFromValue = fromValues[j].mValue;
-        segment->mToKey = toKey;
-        segment->mToValue = toValues[j].mValue;
-        segment->mTimingFunction = easing;
-      }
-      fromValues = Move(toValues);
-      fromKey = toKey;
-    }
-  }
-}
-
-/**
  * Converts a JS object representing a property-indexed keyframe into
  * an array of Keyframe objects.
  *
  * @param aCx The JSContext for |aValue|.
  * @param aValue The JS object.
  * @param aResult The array into which the resulting AnimationProperty
  *   objects will be appended.
  * @param aRv Out param to store any errors thrown by this function.
@@ -1690,24 +1131,9 @@ RequiresAdditiveAnimation(const nsTArray
       }
     }
   }
 
   return !propertiesWithFromValue.Equals(properties) ||
          !propertiesWithToValue.Equals(properties);
 }
 
-already_AddRefed<nsStyleContext>
-LookupStyleContext(dom::Element* aElement, CSSPseudoElementType aPseudoType)
-{
-  nsIDocument* doc = aElement->GetCurrentDoc();
-  nsIPresShell* shell = doc->GetShell();
-  if (!shell) {
-    return nullptr;
-  }
-
-  nsIAtom* pseudo =
-    aPseudoType < CSSPseudoElementType::Count ?
-    nsCSSPseudoElements::GetPseudoAtom(aPseudoType) : nullptr;
-  return nsComputedDOMStyle::GetStyleContextForElement(aElement, pseudo, shell);
-}
-
 } // namespace mozilla
--- a/dom/animation/KeyframeUtils.h
+++ b/dom/animation/KeyframeUtils.h
@@ -29,35 +29,16 @@ namespace mozilla {
 
 /**
  * Utility methods for processing keyframes.
  */
 class KeyframeUtils
 {
 public:
   /**
-  * Converts a JS value to a property-indexed keyframe or a sequence of
-  * regular keyframes and builds an array of AnimationProperty objects for the
-  * keyframe animation that it specifies.
-  *
-  * @param aTarget The target of the animation, used to resolve style
-  *   for a property's underlying value if needed.
-  * @param aFrames The JS value, provided as an optional IDL |object?| value,
-  *   that is the keyframe list specification.
-  * @param aResult The array into which the resulting AnimationProperty
-  *   objects will be appended.
-  */
-  static void
-  BuildAnimationPropertyList(JSContext* aCx, Element* aTarget,
-                             CSSPseudoElementType aPseudoType,
-                             JS::Handle<JSObject*> aFrames,
-                             InfallibleTArray<AnimationProperty>& aResult,
-                             ErrorResult& aRv);
-
-  /**
    * Converts a JS value representing a property-indexed keyframe or a sequence
    * of keyframes to an array of Keyframe objects.
    *
    * @param aCx The JSContext that corresponds to |aFrames|.
    * @param aFrames The JS value, provided as an optional IDL |object?| value,
    *   that is the keyframe list specification.
    * @param aRv (out) Out-param to hold any error returned by this function.
    *   Must be initially empty.