Bug 1244641 - Part 1: Let AnimationEffectTiming have an effect. r=hiro

MozReview-Commit-ID: REfKyGs4HK

--HG--
extra : transplant_source : %1D%BF%B3%7EU%C1%AEp%FC%E7%97%9Ds%1C%C1.%DAS%12%EF
This commit is contained in:
Ryo Motozawa 2016-02-27 06:39:30 +09:00
Родитель a072c8c433
Коммит ec3f99ba71
4 изменённых файлов: 20 добавлений и 4 удалений

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

@ -8,6 +8,7 @@
#define mozilla_dom_AnimationEffectTiming_h
#include "mozilla/dom/AnimationEffectTimingReadOnly.h"
#include "mozilla/Attributes.h" // For MOZ_NON_OWNING_REF
namespace mozilla {
namespace dom {
@ -15,10 +16,16 @@ namespace dom {
class AnimationEffectTiming : public AnimationEffectTimingReadOnly
{
public:
explicit AnimationEffectTiming(const TimingParams& aTiming)
: AnimationEffectTimingReadOnly(aTiming) { }
AnimationEffectTiming(const TimingParams& aTiming, KeyframeEffect* aEffect)
: AnimationEffectTimingReadOnly(aTiming)
, mEffect(aEffect) { }
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
void Unlink() override { mEffect = nullptr; }
private:
KeyframeEffect* MOZ_NON_OWNING_REF mEffect;
};
} // namespace dom

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

@ -97,6 +97,8 @@ public:
const TimingParams& AsTimingParams() const { return mTiming; }
void SetTimingParams(const TimingParams& aTiming) { mTiming = aTiming; }
virtual void Unlink() { }
protected:
nsCOMPtr<nsISupports> mParent;
TimingParams mTiming;

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

@ -2142,7 +2142,7 @@ KeyframeEffect::KeyframeEffect(nsIDocument* aDocument,
CSSPseudoElementType aPseudoType,
const TimingParams& aTiming)
: KeyframeEffectReadOnly(aDocument, aTarget, aPseudoType,
new AnimationEffectTiming(aTiming))
new AnimationEffectTiming(aTiming, this))
{
}
@ -2153,5 +2153,10 @@ KeyframeEffect::WrapObject(JSContext* aCx,
return KeyframeEffectBinding::Wrap(aCx, this, aGivenProto);
}
KeyframeEffect::~KeyframeEffect()
{
mTiming->Unlink();
}
} // namespace dom
} // namespace mozilla

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

@ -19,7 +19,6 @@
#include "mozilla/StyleAnimationValue.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/dom/AnimationEffectReadOnly.h"
#include "mozilla/dom/AnimationEffectTiming.h"
#include "mozilla/dom/AnimationEffectTimingReadOnly.h" // TimingParams
#include "mozilla/dom/Element.h"
#include "mozilla/dom/KeyframeBinding.h"
@ -428,6 +427,9 @@ public:
return ConstructKeyframeEffect<KeyframeEffect>(aGlobal, aTarget, aFrames,
aTiming, aRv);
}
protected:
~KeyframeEffect() override;
};
} // namespace dom