Bug 233075

Summary: Add a helper class to coordinate batch analysis of images
Product: WebKit Reporter: Wenson Hsieh <wenson_hsieh>
Component: PlatformAssignee: Wenson Hsieh <wenson_hsieh>
Status: RESOLVED FIXED    
Severity: Normal CC: akeerthi, annulen, bdakin, dino, ews-watchlist, gyuyoung.kim, hi, megan_gardner, ryuan.choi, sergio, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 233210    
Attachments:
Description Flags
Patch
none
Rebase + implement more logic
none
Remove unnecessary SPI
dino: review+
Patch for landing none

Description Wenson Hsieh 2021-11-12 15:36:44 PST
.
Comment 1 Wenson Hsieh 2021-11-12 15:57:48 PST Comment hidden (obsolete)
Comment 2 Wenson Hsieh 2021-11-16 08:51:20 PST Comment hidden (obsolete)
Comment 3 Wenson Hsieh 2021-11-17 08:50:31 PST
Created attachment 444527 [details]
Remove unnecessary SPI
Comment 4 Dean Jackson 2021-11-17 11:21:04 PST
Comment on attachment 444527 [details]
Remove unnecessary SPI

View in context: https://bugs.webkit.org/attachment.cgi?id=444527&action=review

> Source/WebCore/page/ImageAnalysisQueue.cpp:59
> +    auto imageIterator = document.images()->createIterator();

What order does document.images() use? I wonder if we can have an iterator that is in document order (more likely to have the images on screen up front).

Also, what happens with lazy loaded images?
Comment 5 Wenson Hsieh 2021-11-17 11:29:51 PST
Comment on attachment 444527 [details]
Remove unnecessary SPI

View in context: https://bugs.webkit.org/attachment.cgi?id=444527&action=review

Thanks for the review!

>> Source/WebCore/page/ImageAnalysisQueue.cpp:59
>> +    auto imageIterator = document.images()->createIterator();
> 
> What order does document.images() use? I wonder if we can have an iterator that is in document order (more likely to have the images on screen up front).
> 
> Also, what happens with lazy loaded images?

Good question! So `document.images()` is already in DOM order, but this is actually not ideal because (as you hinted) it would be better to prioritize images that are on-screen vs. images that are offscreen.

For lazily loaded images, I *think* we'll also exclude them from the queue here because the cached image would be 0x0. I have a followup task to add a way to queue images that are dynamically inserted into the document, so I'll use that to make sure lazy loaded images are also handled by these changes. For the time being, I'll file a new bugzilla bug and add a FIXME here.
Comment 6 Wenson Hsieh 2021-11-17 11:35:19 PST
Created attachment 444542 [details]
Patch for landing
Comment 7 EWS 2021-11-17 12:22:18 PST
Committed r285949 (244351@main): <https://commits.webkit.org/244351@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 444542 [details].
Comment 8 Radar WebKit Bug Importer 2021-11-17 12:23:26 PST
<rdar://problem/85515876>