Bug 249113 - Progressive Images (e.g., JPEG) should render while loading
Summary: Progressive Images (e.g., JPEG) should render while loading
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-12-11 15:25 PST by Ahmad Saleem
Modified: 2023-12-17 14:30 PST (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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/