Bug 1305325 - Part 2: Add AnimValuesStyleRule::GetValue and HasValue to get the last composed style. r=birtles
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Sun, 04 Dec 2016 08:07:39 +0900
changeset 325224 e1933856b6701f080c4c79d993a9bad43bc350b6
parent 325223 da6c574e481eec99427e376602b5172631a30ab3
child 325225 b49d2c0ee616b893ab13518babfb9cdaa825d959
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersbirtles
bugs1305325
milestone53.0a1
Bug 1305325 - Part 2: Add AnimValuesStyleRule::GetValue and HasValue to get the last composed style. r=birtles HasValue() will be used to check that we have already composed style for a given property or not. MozReview-Commit-ID: L8lezGyON5o
dom/animation/AnimValuesStyleRule.cpp
dom/animation/AnimValuesStyleRule.h
--- a/dom/animation/AnimValuesStyleRule.cpp
+++ b/dom/animation/AnimValuesStyleRule.cpp
@@ -78,16 +78,23 @@ AnimValuesStyleRule::AddValue(nsCSSPrope
 {
   MOZ_ASSERT(aProperty != eCSSProperty_UNKNOWN,
              "Unexpected css property");
   mAnimationValues.Put(aProperty, Move(aValue));
   mStyleBits |=
     nsCachedStyleData::GetBitForSID(nsCSSProps::kSIDTable[aProperty]);
 }
 
+bool
+AnimValuesStyleRule::GetValue(nsCSSPropertyID aProperty,
+                              StyleAnimationValue& aValue) const
+{
+  return mAnimationValues.Get(aProperty, &aValue);
+}
+
 #ifdef DEBUG
 void
 AnimValuesStyleRule::List(FILE* out, int32_t aIndent) const
 {
   nsAutoCString str;
   for (int32_t index = aIndent; --index >= 0; ) {
     str.AppendLiteral("  ");
   }
--- a/dom/animation/AnimValuesStyleRule.h
+++ b/dom/animation/AnimValuesStyleRule.h
@@ -40,16 +40,21 @@ public:
   void List(FILE* out = stdout, int32_t aIndent = 0) const override;
 #endif
 
   // For the following functions, it there is already a value for |aProperty| it
   // will be replaced with |aValue|.
   void AddValue(nsCSSPropertyID aProperty, const StyleAnimationValue &aValue);
   void AddValue(nsCSSPropertyID aProperty, StyleAnimationValue&& aValue);
 
+  bool HasValue(nsCSSPropertyID aProperty) const {
+    return mAnimationValues.Contains(aProperty);
+  }
+  bool GetValue(nsCSSPropertyID aProperty, StyleAnimationValue& aValue) const;
+
 private:
   ~AnimValuesStyleRule() {}
 
   nsDataHashtable<nsUint32HashKey, StyleAnimationValue> mAnimationValues;
 
   uint32_t mStyleBits;
 };