Bug 1087536 patch 3 - Use new no-selector-matching hints for animation restyles. r=birtles

This depends on bug 1086937 patch 1 because it requires that
ResolveStyleWithReplacement support eRestyle_ChangeAnimationPhase on
::before and ::after pseudo-elements.

It also depends on patch 1 of this bug for the reasons described in
patch 1's commit message.

This is needed for bug 960465 so that we can use these hints to detect
whether pending restyles include restyles other than those for
animations.  In other words, patches for bug 960465 (or perhaps a
dependent bug that lands before it) will require that all animation
restyles use an animation-specific nsRestyleHint.

It is also, on its own, a performance improvement for animations and
transitions, since we will stop rerunning selector matching on the
animating element during the progress of the animations or transitions.
Once we remove eRestyle_ChangeAnimationPhase the performance improvement
will even become slightly better.

Note that the eRestyle_ChangeAnimationPhase is needed in some cases
because we use PostRestyleForAnimation in the non-animation-restyle
phase when we have a style rule that we need to add during the animation
restyle phase.  (It's not needed during the progress of the animation,
though.  But hopefully both eRestyle_ChangeAnimationPhase will go away
soon, after bug 960465.  And hopefully the way we tick animations will
also change to look more like the animation-only restyle, but without
the main-thread-suppressed (throttled) animations.)
This commit is contained in:
L. David Baron 2014-11-17 11:39:14 -08:00
parent 45e5ce14aa
commit 7348f9ea5a

View File

@ -295,7 +295,10 @@ struct AnimationPlayerCollection : public PRCList
void PostRestyleForAnimation(nsPresContext *aPresContext) {
mozilla::dom::Element* element = GetElementToRestyle();
if (element) {
aPresContext->PresShell()->RestyleForAnimation(element, eRestyle_Self);
nsRestyleHint hint = IsForTransitions() ? eRestyle_CSSTransitions
: eRestyle_CSSAnimations;
hint |= eRestyle_ChangeAnimationPhase;
aPresContext->PresShell()->RestyleForAnimation(element, hint);
}
}