Bug 1861259 part 3: Coalesce redundant array-index checks in nsRefreshDriver. r=tnikkel

This patch doesn't change behavior; it just removes some redundant checks.

(Note that the tight-scoping around nsAutoMicroTask/ReduceAnimations is
important for the RAII object to be torn down at the intended time; but it
doesn't need its own if-check.)

Depends on D191909

Differential Revision: https://phabricator.services.mozilla.com/D191911
This commit is contained in:
Daniel Holbert 2023-10-25 23:50:05 +00:00
parent 98398d6c56
commit 071c722cc0

View file

@ -2427,19 +2427,18 @@ bool nsRefreshDriver::TickObserverArray(uint32_t aIdx, TimeStamp aNowTime) {
//
// [1]
// https://drafts.csswg.org/web-animations-1/#update-animations-and-send-events
if (aIdx == 1) {
nsAutoMicroTask mt;
ReduceAnimations(*mPresContext->Document());
}
// Check if running the microtask checkpoint caused the pres context to
// be destroyed.
if (aIdx == 1 && (!mPresContext || !mPresContext->GetPresShell())) {
return false;
}
if (aIdx == 1) {
// This is the FlushType::Style case.
{
nsAutoMicroTask mt;
ReduceAnimations(*mPresContext->Document());
}
// Check if running the microtask checkpoint caused the pres context to
// be destroyed.
if (!mPresContext || !mPresContext->GetPresShell()) {
return false;
}
FlushAutoFocusDocuments();
DispatchScrollEvents();