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 changes the coalescing behavior during the animation-only style
flush by doing tree-based coalescing between the style updates required
by animations and those required by transitions, rather than doing
animations and transitions separately.
Note that both the old and the new code update all
animating/transitioning styles rather than only the throttled styles,
though we should fix that eventually as noted in the FIXME comment in
the code (but only for the existing caller, and not for the new one to
be introduced in bug 960465).
Note that this depends for its correctness on the previous patches to
make the restyling process exact.
The test changes are because the effects of bug 1031688 are changed by
the change in coalescing. In the old code, we updated transition styles
before animation styles; in the new code we do a single pass over the
tree, which for the relevant test means updating animations on the
parent before transitions on the child, which changes the effects of the
bug.
This will be necessary when we use the restyle tracker for the
animation-only style flush, because animation-only style flushes need to
update *only* the animation style data and no other style data. Thus
using the RestyleTracker for animation-only style flushes requires that
we do this.
This changes the coalescing behavior during the animation-only style
flush by doing tree-based coalescing between the style updates required
by animations and those required by transitions, rather than doing
animations and transitions separately.
Note that both the old and the new code update all
animating/transitioning styles rather than only the throttled styles,
though we should fix that eventually as noted in the FIXME comment in
the code (but only for the existing caller, and not for the new one to
be introduced in bug 960465).
Note that this depends for its correctness on the previous patches to
make the restyling process exact.
The test changes are because the effects of bug 1031688 are changed by
the change in coalescing. In the old code, we updated transition styles
before animation styles; in the new code we do a single pass over the
tree, which for the relevant test means updating animations on the
parent before transitions on the child, which changes the effects of the
bug.
This will be necessary when we use the restyle tracker for the
animation-only style flush, because animation-only style flushes need to
update *only* the animation style data and no other style data. Thus
using the RestyleTracker for animation-only style flushes requires that
we do this.
This means ResolveStyleWithReplacement will replace only the rules in
the nsRestyleHint rather than always replacing both the animations rule
and the transitions rule. (This will become even more useful later when
we add the ability to replace the style attribute rule.)
This is the start of a refactoring of the existing code in
CommonAnimationManager, nsTransitionManager, and nsAnimationManager,
which will be removed in later patches (after patches in between cause
this code to be used instead of the current code).
But it also handles interesting cases more correctly, such as cases
where style context parents are unusual.
FIXME: It would be nice to add tests for these cases, but they're mostly
pretty obscure (e.g., a transition of 'transform' that's affected by
inheriting 'transform' from ::first-line), so I'm not treating it as a
priority right now.
FIXME: Adjust for eRestyle_Force if bug 931668 lands first.
Later patches will add such types that are like eRestyle_Self but that
only replace the style attribute, animation rule, or transition rule.
Later patches will combine the coalescing of restyling between the
miniflush performed for animations and for transitions into a single
RestyleTracker, which will coalesce the work better. This patch changes
the API exposed for doing that so that the coalescing patch will contain
only the internals.
This affects the correctness of transitions that take over from a
running animation. (In the current code this can happen on a single
element; once the cascading changes in bug 960465 are complete it can
only happen via inheritance.)
This version of the patch changes to do the test using opacity rather
than transform, since testing using transforms encountered issues
related to bug 1031688: the presence of phantom transitions due to the
interaction of the computed value rules for transforms distinguishing
between values that the interpolation rules consider identical. (These
problems only appear after patch 24 in this bug changes the coalescing
order between a parent with animations and a child with transitions so
that the parent is handled before the child, instead of transitions
being handled before animations.)
The final two added tests fail without the patch and pass with the patch.
(With the opacity version, the third to last test also fails without the
patch, probably due to the value not having yet been sent to the layer.
This was not an issue pre-patch with the original test using transform,
though. I haven't tested that this happened with patch 0, though, so it
might have been the issue patch 0 fixes.)
- RestyleManager::RecomputePosition now calls
StickyScrollContainer::PositionContinuation with the first continuation
or ib-split-sibling of the passed frame, as PositionContinuations will
update all continuations at once, and expects the first continuation
to be passed in.
This is needed to avoid hitting the assertion "Why did this not get
handled while processing mRestyleRoots?" in CollectRestyles, because we
have a restyle posted for a frame that has the NEEDS_FRAME bit flag set.
- OverflowChangedTracker::AddFrame now accepts an enumerated type parameter to
indicate if the overflow areas of children have changed (CHILDREN_CHANGED),
the overflow areas of the children have changed and the parent have changed
(CHILDREN_AND_PARENT_CHANGED), or if only the transform has changed
(TRANSFORM_CHANGED).
- OverflowChangedTracker::Flush no longer falls back to calling
nsIFrame::UpdateOverflow when a frame lacks a PreTransformOverflowAreas
property.
- Added an additional change hint, nsChangeHint_ChildrenOnlyTransform, which
results in TRANSFORM_CHANGED being passed in to
OverflowChangedTracker::AddFrame.
- In nsIFrame::FinishAndStoreOverflow, the passed in overflow is now stored as
the InitialTransformProperty for elements that are IsTransformed().
- Partially corrected Bug 926155, by only calling
OverflowChangedTracker::AddFrame on parents of the sticky element during
StickyScrollContainer::UpdatePositions, using CHILDREN_CHANGED.
- OverflowChangedTracker::AddFrame now accepts an enumerated type parameter to
indicate if the overflow areas of children have changed (CHILDREN_CHANGED) or
if the transform has changed (TRANSFORM_CHANGED).
- OverflowChangedTracker::Flush no longer falls back to calling
nsIFrame::UpdateOverflow when a frame lacks a PreTransformOverflowAreas
property.
- Added an additional change hint, nsChangeHint_ChildrenOnlyTransform, which
results in TRANSFORM_CHANGED being passed in to
OverflowChangedTracker::AddFrame.
- In nsIFrame::FinishAndStoreOverflow, the passed in overflow is now stored as
the InitialTransformProperty for elements that are IsTransformed().
- Partially corrected Bug 926155, by only calling
OverflowChangedTracker::AddFrame on parents of the sticky element during
StickyScrollContainer::UpdatePositions, using CHILDREN_CHANGED.