diff --git a/app/src/common/shared/com/igalia/wolvic/browser/engine/Session.java b/app/src/common/shared/com/igalia/wolvic/browser/engine/Session.java index 905e2a2782..37a2f269d1 100644 --- a/app/src/common/shared/com/igalia/wolvic/browser/engine/Session.java +++ b/app/src/common/shared/com/igalia/wolvic/browser/engine/Session.java @@ -12,6 +12,9 @@ import android.content.SharedPreferences; import android.graphics.Bitmap; import androidx.preference.PreferenceManager; + +import android.os.Handler; +import android.os.Looper; import android.util.Log; import android.view.Surface; import android.view.inputmethod.CursorAnchorInfo; @@ -1364,6 +1367,13 @@ public void onFirstComposite(@NonNull WSession aSession) { for (WSession.ContentDelegate listener : mContentListeners) { listener.onFirstContentfulPaint(aSession); } + } else if (!mState.mIsLoading) { + new Handler(Looper.getMainLooper()).postDelayed(() -> { + // onFirstContentfulPaint is not emitted sometimes when loading a page from + // the cache. This is a workaround to ensure that the event is emitted. + if (!mFirstContentfulPaint) + onFirstContentfulPaint(aSession); + }, 500); } } }