Bug 214452

Summary: [WebGL] Safari snapshots of WebGL content in the tab picker don't work
Product: WebKit Reporter: Justin Fan <justin_fan>
Component: WebGLAssignee: Justin Fan <justin_fan>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, changseok, darin, dino, esprehn+autocc, ews-watchlist, glenn, graouts, gyuyoung.kim, kondapallykalyan, pdr, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch darin: review+

Description Justin Fan 2020-07-17 05:06:58 PDT
Support displaying WebGL canvases in Safari tab preview and tab overview features.
Comment 1 Justin Fan 2020-07-17 05:07:25 PDT
<rdar://problem/21243082>
Comment 2 Justin Fan 2020-07-22 20:03:20 PDT
Created attachment 405013 [details]
Patch
Comment 3 Justin Fan 2020-07-22 20:04:49 PDT
Sort of WIP patch for now. The snapshot will use the last-painted Image by the canvas if the Page is no longer active when the snapshot is requested. May still try to write an internal test for the snapshotting feature.
Comment 4 Justin Fan 2020-07-22 20:05:12 PDT
To clarify, the code works, but there's no test.
Comment 5 Darin Adler 2020-07-23 09:12:32 PDT
Comment on attachment 405013 [details]
Patch

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

> Source/WebCore/ChangeLog:9
> +        No new tests; writing a test may involve adding a new feature to TestRunner to trigger this path.

Understood. Could we please add that feature?
Comment 6 Tim Horton 2020-07-23 11:13:13 PDT
(Probably we should just write an API test similar to the other snapshotting tests)
Comment 7 Justin Fan 2020-07-23 11:39:59 PDT
Should have checked this earlier, but iOS just works. This only occurred on mac.
Comment 8 Dean Jackson 2020-07-23 15:02:09 PDT
Comment on attachment 405013 [details]
Patch

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

>> Source/WebCore/ChangeLog:9
>> +        No new tests; writing a test may involve adding a new feature to TestRunner to trigger this path.
> 
> Understood. Could we please add that feature?

We definitely should. Either an API test or something in Internals.

Internals could expose the same thing that the Web Inspector uses with "PageAgent.snapshotNode", which ultimately is WebCore::snapshotNode, and either return the ImageBuffer as an HTMLImageElement, an ArrayBuffer (for drawing into a canvas) or even a DOMString via toDataURL("image/png"_s, WTF::nullopt, PreserveResolution::Yes) on the result.
Comment 9 Dean Jackson 2020-07-23 15:03:09 PDT
I slightly prefer using Internals because then it can be a reftest in LayoutTests, which I think people run more frequently than API tests.
Comment 10 Dean Jackson 2020-07-30 16:23:15 PDT
Committed r265116: <https://trac.webkit.org/changeset/265116>
Comment 11 Dean Jackson 2020-07-30 16:26:53 PDT
I added an API test (although mac only at the moment).