Bug 249113

Summary: Progressive Images (e.g., JPEG) should render while loading
Product: WebKit Reporter: Ahmad Saleem <ahmad.saleem792>
Component: ImagesAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: don.olmstead, Hironori.Fujii, mateusz.karpow, mattwoodrow, mmaxfield, rego, sabouhallawa, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=272350

Description Ahmad Saleem 2022-12-11 15:25:53 PST
Hi Team,

While going through Blink's commit, it seems that Webkit wait for image to be loaded rather than loading it progressively.

Failing Test Case - https://jsfiddle.net/6y4zjb17/

Safari 16.1 will take ages to load image while Chrome will load it progressively.

Blink Commit - https://src.chromium.org/viewvc/blink?view=revision&revision=198593

Webkit GitHub Source - https://github.com/WebKit/WebKit/blob/bf6ec0b71883ada1ee6d8d0c66a8ea7e421c5e27/Source/WebCore/rendering/RenderLayerBacking.cpp#LL3109

Just wanted to raise this bug so this can be fixed.

Thanks!
Comment 1 Ahmad Saleem 2022-12-13 17:09:00 PST
After discussion with Simon on Slack, it is needed because partially loaded images should not go to Core Animation on Cocoa platforms.

There might be strategic fix in future to get rid of this but Simon mentioned that it is still valuable to keep this open for future tracking purposes.
Comment 2 Radar WebKit Bug Importer 2022-12-18 15:26:16 PST
<rdar://problem/103499397>
Comment 3 Ahmad Saleem 2023-03-14 15:45:49 PDT
I think adding #if PLATFORM(COCOA) etc. around this will fix it for WinCairo, WPE and GTK platforms, which does not use 'Core Animation' and make progressive JPEG loading for those platforms better.
Comment 4 Ahmad Saleem 2023-06-29 02:20:26 PDT
(In reply to Ahmad Saleem from comment #3)
> I think adding #if PLATFORM(COCOA) etc. around this will fix it for
> WinCairo, WPE and GTK platforms, which does not use 'Core Animation' and
> make progressive JPEG loading for those platforms better.

I think adding:


#if !PLATFORM(WPE) && !PLATFORM(GTK) && !PLATFORM(WIN)
// We have to wait until the image is fully loaded before setting it on the layer.
if (!cachedImage->isLoaded())
    return;
#endif

would make it at least work for other platform and they will get better performance. I am happy to do patch but it wouldn't have test case.
Comment 5 Ahmad Saleem 2023-09-07 14:21:59 PDT
Closing my PR: https://github.com/WebKit/WebKit/pull/15503

Tried to add flags but need input from Simon or someone from Apple team with knowledge of where we use this settings, so we can only allow it on those rather than other way around to disable on non-apple ports.
Comment 6 Ahmad Saleem 2023-12-17 14:30:45 PST
Test URL - http://home.mcom.com/
Comment 7 Ahmad Saleem 2024-07-24 06:46:17 PDT
SVN link is gone so reference - https://github.com/chromium/chromium/commit/4c296462f985890e24a2a552f6c6da54a2010ea9