Bug 1026302 part 1 - Move IsForElement and PseudoElement from ElementAnimations to CommonElementAnimationData; r=dbaron

IsForElement and PseudoElement are currently only defined on ElementAnimations
but could be used for transitions. This patch moves these methods to the common
base class CommonElementAnimationData and also makes use of PseudoElement within
nsTransitionManager.
This commit is contained in:
Brian Birtles 2014-06-23 10:48:01 +09:00
parent 707a63f777
commit 09c9b39802
3 changed files with 18 additions and 18 deletions

View File

@ -474,6 +474,23 @@ struct CommonElementAnimationData : public PRCList
bool CanPerformOnCompositorThread(CanAnimateFlags aFlags) const;
bool HasAnimationOfProperty(nsCSSProperty aProperty) const;
bool IsForElement() const { // rather than for a pseudo-element
return mElementProperty == nsGkAtoms::animationsProperty ||
mElementProperty == nsGkAtoms::transitionsProperty;
}
nsString PseudoElement()
{
if (IsForElement()) {
return EmptyString();
} else if (mElementProperty == nsGkAtoms::animationsOfBeforeProperty ||
mElementProperty == nsGkAtoms::transitionsOfBeforeProperty) {
return NS_LITERAL_STRING("::before");
} else {
return NS_LITERAL_STRING("::after");
}
}
static void LogAsyncAnimationFailure(nsCString& aMessage,
const nsIContent* aContent = nullptr);

View File

@ -62,19 +62,6 @@ struct ElementAnimations MOZ_FINAL
void GetEventsAt(TimeStamp aRefreshTime, EventArray &aEventsToDispatch);
bool IsForElement() const { // rather than for a pseudo-element
return mElementProperty == nsGkAtoms::animationsProperty;
}
nsString PseudoElement()
{
return mElementProperty == nsGkAtoms::animationsProperty ?
EmptyString() :
mElementProperty == nsGkAtoms::animationsOfBeforeProperty ?
NS_LITERAL_STRING("::before") :
NS_LITERAL_STRING("::after");
}
void PostRestyleForAnimation(nsPresContext *aPresContext) {
nsRestyleHint styleHint = IsForElement() ? eRestyle_Self : eRestyle_Subtree;
aPresContext->PresShell()->RestyleForAnimation(mElement, styleHint);

View File

@ -848,11 +848,7 @@ nsTransitionManager::FlushTransitions(FlushFlags aFlags)
events.AppendElement(
TransitionEventInfo(et->mElement, prop,
anim->mTiming.mIterationDuration,
ep == nsGkAtoms::transitionsProperty ?
EmptyString() :
ep == nsGkAtoms::transitionsOfBeforeProperty ?
before :
after));
et->PseudoElement()));
// Leave this transition in the list for one more refresh
// cycle, since we haven't yet processed its style change, and