This is similar to bug #210636 but it happens under wayland when using GTK4. It's good idea to flush always after painting in any case, so we do ity in case of GTK3 as well.
Created attachment 403951 [details] Patch
Committed r264216: <https://trac.webkit.org/changeset/264216>