Bug 1895928 - PresShell::ScheduleViewManagerFlush shouldn't set the layout flush bit. r=smaug

A version of the patch in bug 1895870 caused some WPT tests to time out
because document.fonts.ready never resolves.

This is because I made PresShell::HasPendingReflow look at
mNeedLayoutFlush, and nsIFrame::SchedulePaint() calls
PresShell::ScheduleViewManagerFlush() which sets that bit.

So we end up with mNeedLayoutFlush, but without a flush scheduled, and
the ready promise doesn't resolve until something else schedules a
flush. I fixed the original patch to preserve behavior, but requesting a
repaint shouldn't require a layout flush.

This call was added in bug 598482 part 16:

  https://hg.mozilla.org/mozilla-central/rev/71d77495b606fc145bdceabcda29181978bd9405

We only need the layout flush if there are view geometry updates, so
shift the call up to the view manager.

Differential Revision: https://phabricator.services.mozilla.com/D209938
This commit is contained in:
Emilio Cobos Álvarez 2024-05-10 08:08:42 +00:00
parent de13ddd2c0
commit 69084521f7
3 changed files with 3 additions and 5 deletions

View file

@ -3931,11 +3931,9 @@ void PresShell::ScheduleViewManagerFlush() {
return; return;
} }
nsPresContext* presContext = GetPresContext(); if (nsPresContext* presContext = GetPresContext()) {
if (presContext) {
presContext->RefreshDriver()->ScheduleViewManagerFlush(); presContext->RefreshDriver()->ScheduleViewManagerFlush();
} }
SetNeedLayoutFlush();
} }
void PresShell::DispatchSynthMouseMove(WidgetGUIEvent* aEvent) { void PresShell::DispatchSynthMouseMove(WidgetGUIEvent* aEvent) {

View file

@ -1081,8 +1081,7 @@ void nsView::DidCompositeWindow(mozilla::layers::TransactionId aTransactionId,
} }
void nsView::RequestRepaint() { void nsView::RequestRepaint() {
PresShell* presShell = mViewManager->GetPresShell(); if (PresShell* presShell = mViewManager->GetPresShell()) {
if (presShell) {
presShell->ScheduleViewManagerFlush(); presShell->ScheduleViewManagerFlush();
} }
} }

View file

@ -455,6 +455,7 @@ void nsViewManager::PostPendingUpdate() {
nsViewManager* rootVM = RootViewManager(); nsViewManager* rootVM = RootViewManager();
rootVM->mHasPendingWidgetGeometryChanges = true; rootVM->mHasPendingWidgetGeometryChanges = true;
if (rootVM->mPresShell) { if (rootVM->mPresShell) {
rootVM->mPresShell->SetNeedLayoutFlush();
rootVM->mPresShell->ScheduleViewManagerFlush(); rootVM->mPresShell->ScheduleViewManagerFlush();
} }
} }