Bug 1254419 - Move GetPropertyState alongside GetFrames; r=hiro
authorBrian Birtles <birtles@gmail.com>
Tue, 15 Mar 2016 21:18:50 +0800
changeset 289242 4f5d2092a6c3d7e8b351db809852c8d6dba1f3ba
parent 289241 98445ee59e8b1d21e82c9a130719f931d924c334
child 289243 631335668763c1209d88613b5820a9dd2497086f
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershiro
bugs1254419
milestone48.0a1
Bug 1254419 - Move GetPropertyState alongside GetFrames; r=hiro This better matches the order in the WebIDL and, once we rename GetPropertyState to GetProperties it will make sense for GetFrames and GetProperties to be side-by-side. MozReview-Commit-ID: 67s9WGksPFv
dom/animation/KeyframeEffect.cpp
dom/animation/KeyframeEffect.h
--- a/dom/animation/KeyframeEffect.cpp
+++ b/dom/animation/KeyframeEffect.cpp
@@ -1795,16 +1795,41 @@ KeyframeEffectReadOnly::GetTarget(
 
     default:
       NS_NOTREACHED("Animation of unsupported pseudo-type");
       aRv.SetNull();
   }
 }
 
 void
+KeyframeEffectReadOnly::GetPropertyState(
+    nsTArray<AnimationPropertyState>& aStates) const
+{
+  for (const AnimationProperty& property : mProperties) {
+    // Bug 1252730: We should also expose this winsInCascade as well.
+    if (!property.mWinsInCascade) {
+      continue;
+    }
+
+    AnimationPropertyState state;
+    state.mProperty.Construct(
+      NS_ConvertASCIItoUTF16(nsCSSProps::GetStringValue(property.mProperty)));
+    state.mRunningOnCompositor.Construct(property.mIsRunningOnCompositor);
+
+    nsXPIDLString localizedString;
+    if (property.mPerformanceWarning &&
+        property.mPerformanceWarning->ToLocalizedString(localizedString)) {
+      state.mWarning.Construct(localizedString);
+    }
+
+    aStates.AppendElement(state);
+  }
+}
+
+void
 KeyframeEffectReadOnly::GetFrames(JSContext*& aCx,
                                   nsTArray<JSObject*>& aResult,
                                   ErrorResult& aRv)
 {
   nsTArray<OrderedKeyframeValueEntry> entries;
 
   for (const AnimationProperty& property : mProperties) {
     for (size_t i = 0, n = property.mSegments.Length(); i < n; i++) {
@@ -1892,42 +1917,16 @@ KeyframeEffectReadOnly::GetFrames(JSCont
       previousEntry = entry;
       entry = &entries[i];
     } while (entry->SameKeyframe(*previousEntry));
 
     aResult.AppendElement(keyframe);
   }
 }
 
-
-void
-KeyframeEffectReadOnly::GetPropertyState(
-    nsTArray<AnimationPropertyState>& aStates) const
-{
-  for (const AnimationProperty& property : mProperties) {
-    // Bug 1252730: We should also expose this winsInCascade as well.
-    if (!property.mWinsInCascade) {
-      continue;
-    }
-
-    AnimationPropertyState state;
-    state.mProperty.Construct(
-      NS_ConvertASCIItoUTF16(nsCSSProps::GetStringValue(property.mProperty)));
-    state.mRunningOnCompositor.Construct(property.mIsRunningOnCompositor);
-
-    nsXPIDLString localizedString;
-    if (property.mPerformanceWarning &&
-        property.mPerformanceWarning->ToLocalizedString(localizedString)) {
-      state.mWarning.Construct(localizedString);
-    }
-
-    aStates.AppendElement(state);
-  }
-}
-
 /* static */ const TimeDuration
 KeyframeEffectReadOnly::OverflowRegionRefreshInterval()
 {
   // The amount of time we can wait between updating throttled animations
   // on the main thread that influence the overflow region.
   static const TimeDuration kOverflowRegionRefreshInterval =
     TimeDuration::FromMilliseconds(200);
 
--- a/dom/animation/KeyframeEffect.h
+++ b/dom/animation/KeyframeEffect.h
@@ -204,16 +204,17 @@ public:
               JS::Handle<JSObject*> aFrames,
               const UnrestrictedDoubleOrKeyframeEffectOptions& aOptions,
               ErrorResult& aRv);
 
   void GetTarget(Nullable<OwningElementOrCSSPseudoElement>& aRv) const;
   void GetFrames(JSContext*& aCx,
                  nsTArray<JSObject*>& aResult,
                  ErrorResult& aRv);
+  void GetPropertyState(nsTArray<AnimationPropertyState>& aStates) const;
 
   // Temporary workaround to return both the target element and pseudo-type
   // until we implement PseudoElement (bug 1174575).
   void GetTarget(Element*& aTarget,
                  CSSPseudoElementType& aPseudoType) const {
     aTarget = mTarget;
     aPseudoType = mPseudoType;
   }
@@ -299,18 +300,16 @@ public:
   // contained in |aSetProperties|.
   // Any updated properties are added to |aSetProperties|.
   void ComposeStyle(RefPtr<AnimValuesStyleRule>& aStyleRule,
                     nsCSSPropertySet& aSetProperties);
   // Returns true if at least one property is being animated on compositor.
   bool IsRunningOnCompositor() const;
   void SetIsRunningOnCompositor(nsCSSProperty aProperty, bool aIsRunning);
 
-  void GetPropertyState(nsTArray<AnimationPropertyState>& aStates) const;
-
   // Returns true if this effect, applied to |aFrame|, contains properties
   // that mean we shouldn't run transform compositor animations on this element.
   //
   // For example, if we have an animation of geometric properties like 'left'
   // and 'top' on an element, we force all 'transform' animations running at
   // the same time on the same element to run on the main thread.
   //
   // When returning true, |aPerformanceWarning| stores the reason why