Bug 1439428 - Call UpdateCascadeResults() directly instead of RestyleRestyle() at the end of Gecko_UpdateAnimations(). r=birtles

Calling RequestRestyle() for update cascade results is weird since in general
RequestRestyle() is a result of updating cascade results (e.g. when an
!important style is changed).  In the case where we already know that we need
to update cascade results we can do it right after all the other processes that
may need to update cascade results has done so that we don't need to worry about
the cases additional cascade results update happens.

MozReview-Commit-ID: 6lh0NgTPF9j

--HG--
extra : rebase_source : 4dbec85f55a14776907b677f2876421abc141384
This commit is contained in:
Hiroyuki Ikezoe 2018-02-23 09:05:26 +09:00
Родитель 77efac4019
Коммит ad663efa0b
2 изменённых файлов: 17 добавлений и 24 удалений

Просмотреть файл

@ -1280,22 +1280,6 @@ waitForAllPaints(() => {
document.body.appendChild(div);
markers = await observeStyling(1);
if (isServo) {
// In Servo, we explicitly set important_rules_change flag to the element
// in compute_style() during the initial normal traversal right after
// re-attaching which leads to invoking a SequentialTask for
// CascadeResults which ends up calling RequestRestyle(Standard). As a
// result, the animation is restyled during a second animation restyle in
// the first frame.
todo_is(markers.length, 1,
'Bug 1388560 We should observe one restyle in the first frame ' +
'right after re-attaching to the document');
} else {
is(markers.length, 1,
'We should observe one restyle in the first frame right after ' +
're-attaching to the document');
}
markers = await observeStyling(5);
is(markers.length, 5,
'Animation on re-attached to the document begins to update style');

Просмотреть файл

@ -671,14 +671,23 @@ Gecko_UpdateAnimations(RawGeckoElementBorrowed aElement,
}
if (aTasks & UpdateAnimationsTasks::CascadeResults) {
// This task will be scheduled if we detected any changes to !important
// rules. We post a restyle here so that we can update the cascade
// results in the pre-traversal of the next restyle.
presContext->EffectCompositor()
->RequestRestyle(const_cast<Element*>(aElement),
pseudoType,
EffectCompositor::RestyleType::Standard,
EffectCompositor::CascadeLevel::Animations);
EffectSet* effectSet = EffectSet::GetEffectSet(aElement, pseudoType);
// CSS animations/transitions might have been destroyed as part of the above
// steps so before updating cascade results, we check if there are still any
// animations to update.
if (effectSet) {
// We call UpdateCascadeResults directly (intead of
// MaybeUpdateCascadeResults) since we know for sure that the cascade has
// changed, but we were unable to call MarkCascadeUpdated when we noticed
// it since we avoid mutating state as part of the Servo parallel
// traversal.
presContext->EffectCompositor()
->UpdateCascadeResults(StyleBackendType::Servo,
*effectSet,
const_cast<Element*>(aElement),
pseudoType,
nullptr);
}
}
if (aTasks & UpdateAnimationsTasks::DisplayChangedFromNone) {