Bug 1225699 part 2 - Add Add/RemoveEffect to EffectSet; r=smaug

This commit is contained in:
Brian Birtles 2015-11-26 16:53:53 +09:00
Родитель 9400c59793
Коммит ac5c423799
2 изменённых файлов: 26 добавлений и 0 удалений

Просмотреть файл

@ -80,4 +80,16 @@ EffectSet::GetEffectSetPropertyAtom(nsCSSPseudoElements::Type aPseudoType)
}
}
void
EffectSet::AddEffect(dom::KeyframeEffectReadOnly& aEffect)
{
mEffects.PutEntry(&aEffect);
}
void
EffectSet::RemoveEffect(dom::KeyframeEffectReadOnly& aEffect)
{
mEffects.RemoveEntry(&aEffect);
}
} // namespace mozilla

Просмотреть файл

@ -8,11 +8,14 @@
#define mozilla_EffectSet_h
#include "nsCSSPseudoElements.h" // For nsCSSPseudoElements::Type
#include "nsHashKeys.h" // For nsPtrHashKey
#include "nsTHashtable.h" // For nsTHashtable
namespace mozilla {
namespace dom {
class Element;
class KeyframeEffectReadOnly;
} // namespace dom
// A wrapper around a hashset of AnimationEffect objects to handle
@ -42,10 +45,21 @@ public:
static EffectSet* GetOrCreateEffectSet(dom::Element* aElement,
nsCSSPseudoElements::Type aPseudoType);
void AddEffect(dom::KeyframeEffectReadOnly& aEffect);
void RemoveEffect(dom::KeyframeEffectReadOnly& aEffect);
private:
// We store a raw (non-owning) pointer here because KeyframeEffectReadOnly
// keeps a strong reference to the target element where this object is
// stored. KeyframeEffectReadOnly is responsible for removing itself from
// this set when it releases its reference to the target element.
typedef nsTHashtable<nsPtrHashKey<dom::KeyframeEffectReadOnly>> EffectPtrSet;
static nsIAtom* GetEffectSetPropertyAtom(nsCSSPseudoElements::Type
aPseudoType);
EffectPtrSet mEffects;
#ifdef DEBUG
bool mCalledPropertyDtor;
#endif