зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
77c19b1008
Коммит
00e736ff46
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче