Open Bug 1650677 Opened 4 years ago Updated 4 years ago

Lazy loading images are not appeared in screenshots

Categories

(Core :: DOM: Core & HTML, defect)

defect

Tracking

()

People

(Reporter: hiro, Unassigned)

References

Details

(Whiteboard: [layout:backlog])

From bug 1648064 comment 21

(In reply to Matt Woodrow (:mattwoodrow) from comment #20)

Hiro, do you know what would be required to force loading of all images for a snapshot?

Lazy loading images totally rely on the DOMIntersectionObserver implementation, which means it relies on ancestor's scroll ports basically (and it also requires to be triggered by a refresh driver tick).

All our various screenshot/snapshot code goes through nsLayoutUtils::PaintFrame, which will sync decode images, but I guess won't load them.

Right, it won't trigger loading, as far as I can tell.

The screenshots browser functionality is currently using CanvasRenderingContext2D::DrawWindow, which is synchronous, and won't work if we need to asynchronously wait for image loads to start.

Without waiting for asynchronous loads, lazy loading images will not appear there. For printing/print preview, what Emilio tries to do in this bug is to disable lazy loading images in static cloned documents in D81780, so that it starts being loaded in the first place (thus, it blocks document load, that's my understanding). So to me for sceenshots, we need to trigger loading lazy loading images and make sure that all lazy loading images have been loaded, then we need to call PaintFrame? To do that, we need to add a chrome only API to load lazy loading images forcibly. That said, it also affects the original document, so I am not sure it's acceptable or not.

FWIW, it doesn't work on Chrome either.

Whiteboard: [layout:backlog]
Severity: -- → S3
You need to log in before you can comment on or make changes to this bug.