Bug 231268

Summary: On Monterey, images in WebView don't always appear when rendered into a PDF context
Product: WebKit Reporter: Brad Andalman <bya>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: bfulgham, bw, simon.fraser, thorton, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Xcode project to reproduce the bug on Monterey
none
Incorrect PDF generated on Monterey
none
Correct PDF generated on Big Sur
none
Correct PDF generated on Catalina none

Description Brad Andalman 2021-10-05 16:49:25 PDT
Created attachment 440294 [details]
Xcode project to reproduce the bug on Monterey

We have an application that uses an unmapped WebView to render the content of a webpage into a PDF. With Monterey, we've noticed that sometimes images just don't appear in the generated PDF.

On Monterey, if we switch to rendering from an onscreen WebView, it becomes more likely that images will appear in the final PDF…but it still isn’t guaranteed.

I’ve attached an Xcode project that illustrates this. By default, this project will create an unmapped WebView, load some static HTML, and render it to “~/Desktop/missingImages.pdf”. On Big Sur and Catalina, you will see an image of a cute puppy on the first page of the PDF. On Monterey, you will see a big red square instead of the image (red is the background-color for that <img> element).

In the project, you can change an “#if 0” to “#if 1” so that it uses an onscreen web view. On Monterey, you will likely see the puppy. As we mentioned above, though, this still doesn’t ALWAYS happen. 

I've filed this regression using Feedback Assistant (FB9681094), but am reporting this here, too, in case it's more of a WebKit issue than a Monterey one.
Comment 1 Brad Andalman 2021-10-05 16:49:52 PDT
Created attachment 440295 [details]
Incorrect PDF generated on Monterey
Comment 2 Brad Andalman 2021-10-05 16:50:13 PDT
Created attachment 440296 [details]
Correct PDF generated on Big Sur
Comment 3 Brad Andalman 2021-10-05 16:50:41 PDT
Created attachment 440297 [details]
Correct PDF generated on Catalina
Comment 4 Radar WebKit Bug Importer 2021-10-06 17:35:10 PDT
<rdar://problem/83960036>
Comment 5 Brad Andalman 2021-10-11 11:41:15 PDT
I see that this bug has been imported into Radar. Is there any way for us to know whether this regression will be fixed before Monterey is released? Thanks so much for any information you might have!
Comment 6 Sam Sneddon [:gsnedders] 2022-05-09 07:41:00 PDT
rdar://83910579