From 69084521f7279841d8f011841564ded6d658d33c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Fri, 10 May 2024 08:08:42 +0000 Subject: [PATCH] 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 --- layout/base/PresShell.cpp | 4 +--- view/nsView.cpp | 3 +-- view/nsViewManager.cpp | 1 + 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index a96335a192da..cd41da37304f 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -3931,11 +3931,9 @@ void PresShell::ScheduleViewManagerFlush() { return; } - nsPresContext* presContext = GetPresContext(); - if (presContext) { + if (nsPresContext* presContext = GetPresContext()) { presContext->RefreshDriver()->ScheduleViewManagerFlush(); } - SetNeedLayoutFlush(); } void PresShell::DispatchSynthMouseMove(WidgetGUIEvent* aEvent) { diff --git a/view/nsView.cpp b/view/nsView.cpp index 7a9addc8e4c4..41988da30cc8 100644 --- a/view/nsView.cpp +++ b/view/nsView.cpp @@ -1081,8 +1081,7 @@ void nsView::DidCompositeWindow(mozilla::layers::TransactionId aTransactionId, } void nsView::RequestRepaint() { - PresShell* presShell = mViewManager->GetPresShell(); - if (presShell) { + if (PresShell* presShell = mViewManager->GetPresShell()) { presShell->ScheduleViewManagerFlush(); } } diff --git a/view/nsViewManager.cpp b/view/nsViewManager.cpp index b9931f0c2a02..dd2f6c77cfa9 100644 --- a/view/nsViewManager.cpp +++ b/view/nsViewManager.cpp @@ -455,6 +455,7 @@ void nsViewManager::PostPendingUpdate() { nsViewManager* rootVM = RootViewManager(); rootVM->mHasPendingWidgetGeometryChanges = true; if (rootVM->mPresShell) { + rootVM->mPresShell->SetNeedLayoutFlush(); rootVM->mPresShell->ScheduleViewManagerFlush(); } }