mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1026302 part 5 - Make a common property dtor for CommonElementAnimationData; r=dbaron
This patch takes the two static methods ElementAnimationsPropertyDtor and ElementTransitionsPropertyDtor and replaces them with a class static on CommonElementAnimationData.
This commit is contained in:
parent
91d5bacca4
commit
c171a38d22
@ -729,6 +729,19 @@ CommonElementAnimationData::LogAsyncAnimationFailure(nsCString& aMessage,
|
||||
printf_stderr(aMessage.get());
|
||||
}
|
||||
|
||||
/*static*/ void
|
||||
CommonElementAnimationData::PropertyDtor(void *aObject, nsIAtom *aPropertyName,
|
||||
void *aPropertyValue, void *aData)
|
||||
{
|
||||
CommonElementAnimationData* data =
|
||||
static_cast<CommonElementAnimationData*>(aPropertyValue);
|
||||
#ifdef DEBUG
|
||||
NS_ABORT_IF_FALSE(!data->mCalledPropertyDtor, "can't call dtor twice");
|
||||
data->mCalledPropertyDtor = true;
|
||||
#endif
|
||||
delete data;
|
||||
}
|
||||
|
||||
void
|
||||
CommonElementAnimationData::EnsureStyleRuleFor(TimeStamp aRefreshTime,
|
||||
EnsureStyleRuleFlags aFlags)
|
||||
|
@ -436,6 +436,9 @@ struct CommonElementAnimationData : public PRCList
|
||||
mElement->DeleteProperty(mElementProperty);
|
||||
}
|
||||
|
||||
static void PropertyDtor(void *aObject, nsIAtom *aPropertyName,
|
||||
void *aPropertyValue, void *aData);
|
||||
|
||||
// This updates mNeedsRefreshes so the caller may need to check
|
||||
// for changes to values (for example, nsAnimationManager provides
|
||||
// CheckNeedsRefresh to register or unregister from observing the refresh
|
||||
|
@ -24,21 +24,6 @@
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::css;
|
||||
|
||||
static void
|
||||
ElementAnimationsPropertyDtor(void *aObject,
|
||||
nsIAtom *aPropertyName,
|
||||
void *aPropertyValue,
|
||||
void *aData)
|
||||
{
|
||||
CommonElementAnimationData *ea =
|
||||
static_cast<CommonElementAnimationData*>(aPropertyValue);
|
||||
#ifdef DEBUG
|
||||
NS_ABORT_IF_FALSE(!ea->mCalledPropertyDtor, "can't call dtor twice");
|
||||
ea->mCalledPropertyDtor = true;
|
||||
#endif
|
||||
delete ea;
|
||||
}
|
||||
|
||||
void
|
||||
nsAnimationManager::UpdateStyleAndEvents(CommonElementAnimationData* aEA,
|
||||
TimeStamp aRefreshTime,
|
||||
@ -150,8 +135,9 @@ nsAnimationManager::GetElementAnimations(dom::Element *aElement,
|
||||
// FIXME: Consider arena-allocating?
|
||||
ea = new CommonElementAnimationData(aElement, propName, this,
|
||||
mPresContext->RefreshDriver()->MostRecentRefresh());
|
||||
nsresult rv = aElement->SetProperty(propName, ea,
|
||||
ElementAnimationsPropertyDtor, false);
|
||||
nsresult rv =
|
||||
aElement->SetProperty(propName, ea,
|
||||
&CommonElementAnimationData::PropertyDtor, false);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("SetProperty failed");
|
||||
delete ea;
|
||||
|
@ -67,21 +67,6 @@ ElementPropertyTransition::ValuePortionFor(TimeStamp aRefreshTime) const
|
||||
.GetValue(computedTiming.mTimeFraction);
|
||||
}
|
||||
|
||||
static void
|
||||
ElementTransitionsPropertyDtor(void *aObject,
|
||||
nsIAtom *aPropertyName,
|
||||
void *aPropertyValue,
|
||||
void *aData)
|
||||
{
|
||||
CommonElementAnimationData* et =
|
||||
static_cast<CommonElementAnimationData*>(aPropertyValue);
|
||||
#ifdef DEBUG
|
||||
NS_ABORT_IF_FALSE(!et->mCalledPropertyDtor, "can't call dtor twice");
|
||||
et->mCalledPropertyDtor = true;
|
||||
#endif
|
||||
delete et;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* nsTransitionManager *
|
||||
*****************************************************************************/
|
||||
@ -632,8 +617,9 @@ nsTransitionManager::GetElementTransitions(dom::Element *aElement,
|
||||
// FIXME: Consider arena-allocating?
|
||||
et = new CommonElementAnimationData(aElement, propName, this,
|
||||
mPresContext->RefreshDriver()->MostRecentRefresh());
|
||||
nsresult rv = aElement->SetProperty(propName, et,
|
||||
ElementTransitionsPropertyDtor, false);
|
||||
nsresult rv =
|
||||
aElement->SetProperty(propName, et,
|
||||
&CommonElementAnimationData::PropertyDtor, false);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("SetProperty failed");
|
||||
delete et;
|
||||
|
Loading…
Reference in New Issue
Block a user