Bug 1245748 - Rename Keyframe-related IDL types to match changes to Web Animations spec; r=heycam, r=bz
authorBrian Birtles <birtles@gmail.com>
Tue, 22 Mar 2016 16:16:39 +0900
changeset 290202 b66be52a688f020717a886deb3905c64bc2a5142
parent 290201 68c978a14bbcec031f298d0a62b7fe2288e07a40
child 290203 b692d554f9319cbdf9b9174e3eef54dce411a4a9
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, bz
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 - Rename Keyframe-related IDL types to match changes to Web Animations spec; r=heycam, r=bz In particular, the spec no longer has Keyframe and PropertyIndexedKeyframes types but rather deals with objects. The algorithms for processing these objects, however, define various Base* types: https://w3c.github.io/web-animations/#dictdef-basepropertyindexedkeyframe https://w3c.github.io/web-animations/#dictdef-basekeyframe https://w3c.github.io/web-animations/#dictdef-basecomputedkeyframe MozReview-Commit-ID: 3RqoEO66kJ
dom/animation/KeyframeEffect.cpp
dom/animation/KeyframeEffect.h
dom/webidl/BaseKeyframeTypes.webidl
dom/webidl/Keyframe.webidl
dom/webidl/PropertyIndexedKeyframes.webidl
dom/webidl/moz.build
--- a/dom/animation/KeyframeEffect.cpp
+++ b/dom/animation/KeyframeEffect.cpp
@@ -2,18 +2,18 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/dom/KeyframeEffect.h"
 
 #include "mozilla/dom/AnimatableBinding.h"
+#include "mozilla/dom/BaseKeyframeTypesBinding.h"
 #include "mozilla/dom/KeyframeEffectBinding.h"
-#include "mozilla/dom/PropertyIndexedKeyframesBinding.h"
 #include "mozilla/AnimationUtils.h"
 #include "mozilla/EffectCompositor.h"
 #include "mozilla/FloatingPoint.h"
 #include "mozilla/LookAndFeel.h" // For LookAndFeel::GetInt
 #include "mozilla/StyleAnimationValue.h"
 #include "Layers.h" // For Layer
 #include "nsCSSParser.h"
 #include "nsCSSPropertySet.h"
@@ -801,17 +801,17 @@ enum class ValuePosition
   First,  // value at 0 used for reverse filling
   Left,   // value coming in to a given offset
   Right,  // value coming out from a given offset
   Last    // value at 1 used for forward filling
 };
 
 /**
  * A single value in a keyframe animation, used by GetFrames to produce a
- * minimal set of Keyframe objects.
+ * minimal set of keyframe objects.
  */
 struct OrderedKeyframeValueEntry : KeyframeValue
 {
   float mOffset;
   const Maybe<ComputedTimingFunction>* mTimingFunction;
   ValuePosition mPosition;
 
   bool SameKeyframe(const OrderedKeyframeValueEntry& aOther) const
@@ -902,20 +902,20 @@ struct KeyframeValueEntry : KeyframeValu
       // Then, by offset.
       return aLhs.mOffset < aRhs.mOffset;
     }
   };
 };
 
 /**
  * A property-values pair obtained from the open-ended properties
- * discovered on a Keyframe or PropertyIndexedKeyframes object.
+ * discovered on a regular keyframe or property-indexed keyframe object.
  *
- * Single values (as required by Keyframe, and as also supported
- * on PropertyIndexedKeyframes) are stored as the only element in
+ * Single values (as required by a regular keyframe, and as also supported
+ * on property-indexed keyframes) are stored as the only element in
  * mValues.
  */
 struct PropertyValuesPair
 {
   nsCSSProperty mProperty;
   nsTArray<nsString> mValues;
 
   class PropertyPriorityComparator
@@ -984,29 +984,29 @@ struct PropertyValuesPair
       uint32_t,
       eCSSProperty_COUNT_no_shorthands,
       eCSSProperty_COUNT - eCSSProperty_COUNT_no_shorthands> mSubpropertyCount;
     mutable bool mSubpropertyCountInitialized;
   };
 };
 
 /**
- * The result of parsing a JS object as a Keyframe dictionary
+ * The result of parsing a JS object as a BaseKeyframe dictionary
  * and getting its property-value pairs from its open-ended
  * properties.
  */
 struct OffsetIndexedKeyframe
 {
-  binding_detail::FastKeyframe mKeyframeDict;
+  binding_detail::FastBaseKeyframe mKeyframeDict;
   nsTArray<PropertyValuesPair> mPropertyValuePairs;
 };
 
 /**
- * An additional property (for a property-values pair) found on a Keyframe
- * or PropertyIndexedKeyframes object.
+ * 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.
 
   struct PropertyComparator
   {
@@ -1180,17 +1180,17 @@ ConvertKeyframeSequence(JSContext* aCx,
     // 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()) {
       ThrowErrorMessage(aCx, MSG_NOT_OBJECT,
                         "Element of sequence<Keyframes> argument");
       return false;
     }
-    // Convert the JS value into a Keyframe dictionary value.
+    // 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());
@@ -1528,17 +1528,17 @@ BuildAnimationPropertyListFromKeyframeSe
   }
 
   // Finally, build an array of AnimationProperty objects in aResult
   // corresponding to the entries.
   BuildSegmentsFromValueEntries(entries, aResult);
 }
 
 /**
- * Converts a JS object to an IDL PropertyIndexedKeyframes and builds an
+ * 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.
  */
@@ -1548,20 +1548,20 @@ BuildAnimationPropertyListFromPropertyIn
     Element* aTarget,
     CSSPseudoElementType aPseudoType,
     JS::Handle<JS::Value> aValue,
     InfallibleTArray<AnimationProperty>& aResult,
     ErrorResult& aRv)
 {
   MOZ_ASSERT(aValue.isObject());
 
-  // Convert the object to a PropertyIndexedKeyframes dictionary to
+  // Convert the object to a PropertyIndexedKeyframe dictionary to
   // get its explicit dictionary members.
-  binding_detail::FastPropertyIndexedKeyframes keyframes;
-  if (!keyframes.Init(aCx, aValue, "PropertyIndexedKeyframes argument",
+  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);
 
@@ -1575,17 +1575,17 @@ BuildAnimationPropertyListFromPropertyIn
                               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
-  // PropertyIndexedKeyframes.
+  // 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.
@@ -1698,20 +1698,19 @@ BuildAnimationPropertyListFromPropertyIn
       }
       fromValues = Move(toValues);
       fromKey = toKey;
     }
   }
 }
 
 /**
- * Converts a JS value to an IDL
- * (PropertyIndexedKeyframes or sequence<Keyframe>) value and builds an
- * array of AnimationProperty objects for the keyframe animation
- * that it specifies.
+ * 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.
  */
@@ -1721,35 +1720,35 @@ KeyframeEffectReadOnly::BuildAnimationPr
     Element* aTarget,
     CSSPseudoElementType aPseudoType,
     JS::Handle<JSObject*> aFrames,
     InfallibleTArray<AnimationProperty>& aResult,
     ErrorResult& aRv)
 {
   MOZ_ASSERT(aResult.IsEmpty());
 
-  // A frame list specification in the IDL is:
+  // A frame list specification in the spec is essentially:
   //
-  // (PropertyIndexedKeyframes or sequence<Keyframe> or SharedKeyframeList)
+  // (PropertyIndexedKeyframe or sequence<Keyframe> or SharedKeyframeList)
   //
   // We don't support SharedKeyframeList yet, but we do the other two.  We
   // manually implement the parts of JS-to-IDL union conversion algorithm
   // from the Web IDL spec, since we have to represent this an object? so
   // we can look at the open-ended set of properties on a
-  // PropertyIndexedKeyframes or Keyframe.
+  // PropertyIndexedKeyframe or Keyframe.
 
   if (!aFrames) {
     // The argument was explicitly null.  In this case, the default dictionary
-    // value for PropertyIndexedKeyframes would result in no keyframes.
+    // 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 PropertyIndexedKeyframes.
+  // 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()) {
@@ -1941,18 +1940,18 @@ KeyframeEffectReadOnly::GetFrames(JSCont
   }
 
   entries.Sort(OrderedKeyframeValueEntry::ForKeyframeGenerationComparator());
 
   for (size_t i = 0, n = entries.Length(); i < n; ) {
     OrderedKeyframeValueEntry* entry = &entries[i];
     OrderedKeyframeValueEntry* previousEntry = nullptr;
 
-    // Create a JS object with the explicit ComputedKeyframe dictionary members.
-    ComputedKeyframe keyframeDict;
+    // Create a JS object with the BaseComputedKeyframe dictionary members.
+    BaseComputedKeyframe keyframeDict;
     keyframeDict.mOffset.SetValue(entry->mOffset);
     keyframeDict.mComputedOffset.Construct(entry->mOffset);
     if (entry->mTimingFunction && entry->mTimingFunction->isSome()) {
       // If null, leave easing as its default "linear".
       keyframeDict.mEasing.Truncate();
       entry->mTimingFunction->value().AppendToString(keyframeDict.mEasing);
     }
     keyframeDict.mComposite.SetValue(CompositeOperation::Replace);
--- a/dom/animation/KeyframeEffect.h
+++ b/dom/animation/KeyframeEffect.h
@@ -20,17 +20,16 @@
 #include "mozilla/OwningNonNull.h"      // OwningNonNull<...>
 #include "mozilla/StickyTimeDuration.h"
 #include "mozilla/StyleAnimationValue.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/TimingParams.h"
 #include "mozilla/dom/AnimationEffectReadOnly.h"
 #include "mozilla/dom/AnimationEffectTimingReadOnly.h"
 #include "mozilla/dom/Element.h"
-#include "mozilla/dom/KeyframeBinding.h"
 #include "mozilla/dom/Nullable.h"
 
 
 struct JSContext;
 class nsCSSPropertySet;
 class nsIContent;
 class nsIDocument;
 class nsIFrame;
rename from dom/webidl/Keyframe.webidl
rename to dom/webidl/BaseKeyframeTypes.webidl
--- a/dom/webidl/Keyframe.webidl
+++ b/dom/webidl/BaseKeyframeTypes.webidl
@@ -1,25 +1,37 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/.
  *
  * The origin of this IDL file is
  * https://w3c.github.io/web-animations/#the-compositeoperation-enumeration
- * https://w3c.github.io/web-animations/#the-keyframe-dictionary
- * https://w3c.github.io/web-animations/#the-computedkeyframe-dictionary
+ * https://w3c.github.io/web-animations/#dictdef-basepropertyindexedkeyframe
+ * https://w3c.github.io/web-animations/#dictdef-basekeyframe
+ * https://w3c.github.io/web-animations/#dictdef-basecomputedkeyframe
  *
- * Copyright © 2015 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
+ * Copyright © 2016 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
  * liability, trademark and document use rules apply.
  */
 
 enum CompositeOperation { "replace", "add", "accumulate" };
 
-dictionary Keyframe {
+// The following dictionary types are not referred to by other .webidl files,
+// but we use it for manual JS->IDL and IDL->JS conversions in
+// KeyframeEffectReadOnly's implementation.
+
+dictionary BasePropertyIndexedKeyframe
+{
+  DOMString easing = "linear";
+  CompositeOperation? composite = null;
+};
+
+dictionary BaseKeyframe {
   double? offset = null;
   DOMString easing = "linear";
   CompositeOperation? composite = null;
 };
 
-dictionary ComputedKeyframe : Keyframe {
+dictionary BaseComputedKeyframe : BaseKeyframe
+{
   double computedOffset;
 };
deleted file mode 100644
--- a/dom/webidl/PropertyIndexedKeyframes.webidl
+++ /dev/null
@@ -1,18 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * The origin of this IDL file is
- * https://w3c.github.io/web-animations/#the-propertyindexedkeyframe-dictionary
- *
- * Copyright © 2015 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
- * liability, trademark and document use rules apply.
- */
-
-// No other .webidl files references this dictionary, but we use it for
-// manual JS->IDL conversions in KeyframeEffectReadOnly's implementation.
-dictionary PropertyIndexedKeyframes {
-  DOMString           easing = "linear";
-  CompositeOperation? composite = null;
-};
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -46,16 +46,17 @@ WEBIDL_FILES = [
     'AudioParam.webidl',
     'AudioProcessingEvent.webidl',
     'AudioStreamTrack.webidl',
     'AudioTrack.webidl',
     'AudioTrackList.webidl',
     'AutocompleteInfo.webidl',
     'AVInputPort.webidl',
     'BarProp.webidl',
+    'BaseKeyframeTypes.webidl',
     'BatteryManager.webidl',
     'BeforeAfterKeyboardEvent.webidl',
     'BeforeUnloadEvent.webidl',
     'BiquadFilterNode.webidl',
     'Blob.webidl',
     'BoxObject.webidl',
     'BroadcastChannel.webidl',
     'BrowserElement.webidl',
@@ -280,17 +281,16 @@ WEBIDL_FILES = [
     'InspectorUtils.webidl',
     'InterAppConnection.webidl',
     'InterAppConnectionRequest.webidl',
     'InterAppMessagePort.webidl',
     'IterableIterator.webidl',
     'KeyAlgorithm.webidl',
     'KeyboardEvent.webidl',
     'KeyEvent.webidl',
-    'Keyframe.webidl',
     'KeyframeEffect.webidl',
     'KillSwitch.webidl',
     'LegacyQueryInterface.webidl',
     'LinkStyle.webidl',
     'ListBoxObject.webidl',
     'LocalMediaStream.webidl',
     'Location.webidl',
     'MediaDeviceInfo.webidl',
@@ -387,17 +387,16 @@ WEBIDL_FILES = [
     'Presentation.webidl',
     'PresentationAvailability.webidl',
     'PresentationConnection.webidl',
     'PresentationDeviceInfoManager.webidl',
     'PresentationReceiver.webidl',
     'PresentationRequest.webidl',
     'ProcessingInstruction.webidl',
     'ProfileTimelineMarker.webidl',
-    'PropertyIndexedKeyframes.webidl',
     'RadioNodeList.webidl',
     'Range.webidl',
     'Rect.webidl',
     'Request.webidl',
     'RequestSyncManager.webidl',
     'RequestSyncScheduler.webidl',
     'ResourceStats.webidl',
     'ResourceStatsManager.webidl',