Bug 1125455 patch 5 - Add Animation::GetAnimationOfProperty. r=birtles
authorL. David Baron <dbaron@dbaron.org>
Thu, 19 Mar 2015 21:10:00 -0700
changeset 263518 ecfe2a2088e9aa5206926e33c506985911eef2cf
parent 263517 9c871bd850d5e65bf840d034f539bda4e9a9eae7
child 263519 3abf6c3d80e308510831edac7f62f7d0d2f80c55
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbirtles
bugs1125455
milestone39.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 1125455 patch 5 - Add Animation::GetAnimationOfProperty. r=birtles This is needed for patch 6.
dom/animation/Animation.cpp
dom/animation/Animation.h
--- a/dom/animation/Animation.cpp
+++ b/dom/animation/Animation.cpp
@@ -247,26 +247,26 @@ Animation::IsInEffect() const
   if (IsFinishedTransition()) {
     return false;
   }
 
   ComputedTiming computedTiming = GetComputedTiming();
   return computedTiming.mTimeFraction != ComputedTiming::kNullTimeFraction;
 }
 
-bool
-Animation::HasAnimationOfProperty(nsCSSProperty aProperty) const
+const AnimationProperty*
+Animation::GetAnimationOfProperty(nsCSSProperty aProperty) const
 {
   for (size_t propIdx = 0, propEnd = mProperties.Length();
        propIdx != propEnd; ++propIdx) {
     if (aProperty == mProperties[propIdx].mProperty) {
-      return true;
+      return &mProperties[propIdx];
     }
   }
-  return false;
+  return nullptr;
 }
 
 void
 Animation::ComposeStyle(nsRefPtr<css::AnimValuesStyleRule>& aStyleRule,
                         nsCSSPropertySet& aSetProperties)
 {
   ComputedTiming computedTiming = GetComputedTiming();
 
--- a/dom/animation/Animation.h
+++ b/dom/animation/Animation.h
@@ -300,17 +300,21 @@ public:
     MOZ_ASSERT(AsTransition(),
                "Calling SetIsFinishedTransition but it's not a transition");
     mIsFinishedTransition = true;
   }
 
   bool IsCurrent() const;
   bool IsInEffect() const;
 
-  bool HasAnimationOfProperty(nsCSSProperty aProperty) const;
+  const AnimationProperty*
+  GetAnimationOfProperty(nsCSSProperty aProperty) const;
+  bool HasAnimationOfProperty(nsCSSProperty aProperty) const {
+    return GetAnimationOfProperty(aProperty) != nullptr;
+  }
   const InfallibleTArray<AnimationProperty>& Properties() const {
     return mProperties;
   }
   InfallibleTArray<AnimationProperty>& Properties() {
     return mProperties;
   }
 
   // Updates |aStyleRule| with the animation values produced by this