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:
1 file changed
+5
@@ -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');
|
||||
|
||||
Reference in new issue
Block a user