This matches patch 2, and also fixes an incorrect use of eRestyle_Self
on the parents of pseudo-elements in order to restyle those
pseudo-elements, where it would not previously have been effective.
This should all be temporary, since this code can go away with bug
960465, when animation phases are removed.
This (like patch 1) posts restyles directly to the pseudo-element
content nodes, which is a new thing as of this bug. Previously we'd
have posted eRestyle_Subtree restyles to the pseudo element's real
element (i.e., the parent of the pseudo-element content node).
This changes the way we post animation restyles for ::before and ::after
pseudo-elements with animations on them.
This (like patch 2) posts restyles directly to the pseudo-element
content nodes, which is a new thing.
This isn't needed right now since AddStyleUpdatesTo is currently only
used when updating main-thread-suppressed animations running on the
compositor. However, it will be needed once we depend on
AddStyleUpdatesTo for bug 960465. And it will have an effect now since
AddStyleUpdatesTo actually adds all animations rather than only the ones
that are suppressed from running on the main thread.
This patch stores the animation name on the Animation object rather than its
AnimationPlayer. This is because Animation objects don't have a reference to
their AnimationPlayer but their AnimationEffect needs access to the animation
name.
This patch also adds an accessor for AnimationPlayer to get the name from its
Animation (since players *do* have a reference to their source animation
content).
This patch fixes a regression from
https://hg.mozilla.org/mozilla-central/rev/31695984cfe2 (bug 1025709). That
patch replaced the EnsureStyleRuleFor method on ElementTransitions and
ElementAnimations with a common method in CommonElementAnimationData.
ElementTransitions::EnsureStyleRuleFor would create a new style rule if
there was no style rule (mStyleRule == nullptr) or if the refresh time was
old (mStyleRuleRefreshTime != aRefreshTime).
ElementAnimations::EnsureStyleRuleFor, however, would create a new style rule
only if mStyleRuleRefreshTime was null or old since a null style rule may
still be valid for animations (unlike transitions). If we bail as soon as we
a null style rule we would never update mNeedsRefreshes when the animation
finishes.
The unified version of EnsureStyleRuleFor in CommonElementAnimationData
adopted the behavior from ElementAnimations checking for a null or old
mStyleRuleRefreshTime.
However, nsTransitionManager::StyleContextChanged sets mStyleRule to nullptr
to indicate that we need to generate a new style rule. This means that we
will fail to create a style rule for the transition in some cases.
This patch addresses this by making nsTransitionManager::StyleContextChanged
set mStyleRuleRefreshTime to a null timestamp. Setting mStyleRule to nullptr
is no longer necessary since EnsureStyleRuleFor will do this when necessary
and nsTransitionManager::mStyleRule is only used after calling
EnsureStyleRuleFor.