commit 10d026cad749d45e315a12960b7c423fa04c564e
parent 7f633e190403627b49767570065ed82cb586e7fb
Author: Markus Stange <mstange.moz@gmail.com>
Date: Mon, 20 Oct 2025 15:57:20 +0000
Bug 1984444 - Set mHadNonTickContentfulPaint to true in the right cases. r=smaug
See https://phabricator.services.mozilla.com/D107859 for the original conversation about
how this code should be structured.
One slightly confusing aspect is that mHadNonTickContentfulPaint really means
"had any contentful paint, tick or no tick".
Differential Revision: https://phabricator.services.mozilla.com/D263468
Diffstat:
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp
@@ -2721,28 +2721,31 @@ bool nsPresContext::HasStoppedGeneratingLCP() const {
void nsPresContext::NotifyContentfulPaint() {
if (mHadFirstContentfulPaint && HasStoppedGeneratingLCP()) {
+ MOZ_ASSERT(mHadNonTickContentfulPaint);
return;
}
nsRootPresContext* rootPresContext = GetRootPresContext();
if (!rootPresContext) {
return;
}
+
if (!mHadNonTickContentfulPaint) {
#ifdef MOZ_WIDGET_ANDROID
(new AsyncEventDispatcher(mDocument, u"MozFirstContentfulPaint"_ns,
CanBubble::eYes, ChromeOnlyDispatch::eYes))
->PostDOMEvent();
#endif
+ mHadNonTickContentfulPaint = true;
}
+
if (!rootPresContext->RefreshDriver()->IsInRefresh()) {
- if (!mHadNonTickContentfulPaint) {
- rootPresContext->RefreshDriver()
- ->AddForceNotifyContentfulPaintPresContext(this);
- mHadNonTickContentfulPaint = true;
- }
+ rootPresContext->RefreshDriver()->AddForceNotifyContentfulPaintPresContext(
+ this);
return;
}
+ // From here on we know that we are inside a refresh tick.
+
if (!mHadFirstContentfulPaint) {
mHadFirstContentfulPaint = true;
mFirstContentfulPaintTransactionId =