fix: prevent image flicker on WebKitGTK 2.50+ (compositing layer fix)

WebKitGTK 2.50.x evicts image textures from GPU memory during
repaints triggered by hover/scroll, causing momentary placeholder
flash. Force each cached image into its own compositing layer via
will-change + translateZ(0) to prevent texture eviction.

Applied in cachedSrc action so all 18 components using it are fixed.

cc
This commit is contained in:
victorrhgap committed 2026-03-24 18:23:22 -06:00
1 parent 499f188bf8
commit 9a1b88e5bf
1 file changed
+5
+5
View File
@@ -13,6 +13,11 @@ import { getCachedImageUrl } from '$lib/services/imageCacheService';
export function cachedSrc(node: HTMLImageElement, url: string | undefined) {
let currentUrl = url;
// Force own compositing layer to prevent WebKitGTK 2.50+ texture
// eviction during repaints (causes placeholder flash on hover/scroll)
node.style.willChange = 'transform';
node.style.transform = 'translateZ(0)';
// Hide until resolved so placeholder shows through
node.style.opacity = '0';
node.removeAttribute('src');