Bug 1339704 - Part 1: Add GenKey API. draft
authorBoris Chiou <boris.chiou@gmail.com>
Tue, 28 Feb 2017 01:32:20 +0800
changeset 490114 b71e3a33f20d4d99511ebd17b776a3c4e3dbc8da
parent 490032 106a96755d3bcebe64bbbc3b521d65d262ba9c02
child 490115 a61c2ed039de1d095801acbc8f1e59e6a259e959
push id46999
push userbmo:boris.chiou@gmail.com
push dateMon, 27 Feb 2017 17:34:55 +0000
bugs1339704
milestone54.0a1
Bug 1339704 - Part 1: Add GenKey API. MozReview-Commit-ID: Dj8taDjve2W
dom/animation/PseudoElementHashEntry.h
--- a/dom/animation/PseudoElementHashEntry.h
+++ b/dom/animation/PseudoElementHashEntry.h
@@ -30,16 +30,22 @@ public:
 
   KeyType GetKey() const { return { mElement, mPseudoType }; }
   bool KeyEquals(KeyTypePointer aKey) const
   {
     return mElement == aKey->mElement &&
            mPseudoType == aKey->mPseudoType;
   }
 
+  static KeyType GenKey(const dom::Element* aElement,
+                        CSSPseudoElementType aPseudoType)
+  {
+    return KeyType(const_cast<Element*>(aElement), aPseudoType);
+  }
+
   static KeyTypePointer KeyToPointer(KeyType& aKey) { return &aKey; }
   static PLDHashNumber HashKey(KeyTypePointer aKey)
   {
     if (!aKey)
       return 0;
 
     // Convert the scoped enum into an integer while adding it to hash.
     // Note: CSSPseudoElementTypeBase is uint8_t, so we convert it into