Backing out bug 1026302 for build bustage changesets 3e719e2cc1bd and 7a2b642bf77a

This commit is contained in:
Brian Birtles 2014-06-23 11:26:59 +09:00
parent d02a3cce38
commit 516d813bbb
3 changed files with 36 additions and 26 deletions

View File

@ -474,28 +474,6 @@ 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");
}
}
void PostRestyleForAnimation(nsPresContext *aPresContext) {
nsRestyleHint styleHint = IsForElement() ? eRestyle_Self : eRestyle_Subtree;
aPresContext->PresShell()->RestyleForAnimation(mElement, styleHint);
}
static void LogAsyncAnimationFailure(nsCString& aMessage,
const nsIContent* aContent = nullptr);

View File

@ -61,6 +61,24 @@ struct ElementAnimations MOZ_FINAL
nsAnimationManager *aAnimationManager, TimeStamp aNow);
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);
}
};
class nsAnimationManager MOZ_FINAL

View File

@ -597,7 +597,12 @@ nsTransitionManager::ConsiderStartingTransition(nsCSSProperty aProperty,
}
}
aElementTransitions->UpdateAnimationGeneration(mPresContext);
aElementTransitions->PostRestyleForAnimation(presContext);
nsRestyleHint hint =
aNewStyleContext->GetPseudoType() ==
nsCSSPseudoElements::ePseudo_NotPseudoElement ?
eRestyle_Self : eRestyle_Subtree;
presContext->PresShell()->RestyleForAnimation(aElement, hint);
*aStartedAny = true;
aWhichStarted->AddProperty(aProperty);
@ -677,7 +682,10 @@ nsTransitionManager::WalkTransitionRule(ElementDependentRuleProcessorData* aData
// We need to immediately restyle with animation
// after doing this.
et->PostRestyleForAnimation(mPresContext);
nsRestyleHint hint =
aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement ?
eRestyle_Self : eRestyle_Subtree;
mPresContext->PresShell()->RestyleForAnimation(aData->mElement, hint);
return;
}
@ -840,7 +848,11 @@ nsTransitionManager::FlushTransitions(FlushFlags aFlags)
events.AppendElement(
TransitionEventInfo(et->mElement, prop,
anim->mTiming.mIterationDuration,
et->PseudoElement()));
ep == nsGkAtoms::transitionsProperty ?
EmptyString() :
ep == nsGkAtoms::transitionsOfBeforeProperty ?
before :
after));
// Leave this transition in the list for one more refresh
// cycle, since we haven't yet processed its style change, and
@ -869,7 +881,9 @@ nsTransitionManager::FlushTransitions(FlushFlags aFlags)
et->mElementProperty == nsGkAtoms::transitionsOfAfterProperty,
"Unexpected element property; might restyle too much");
if (!canThrottleTick || transitionStartedOrEnded) {
et->PostRestyleForAnimation(mPresContext);
nsRestyleHint hint = et->mElementProperty == nsGkAtoms::transitionsProperty ?
eRestyle_Self : eRestyle_Subtree;
mPresContext->PresShell()->RestyleForAnimation(et->mElement, hint);
} else {
didThrottle = true;
}