Bug 214452 - [WebGL] Safari snapshots of WebGL content in the tab picker don't work
Summary: [WebGL] Safari snapshots of WebGL content in the tab picker don't work
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Justin Fan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-07-17 05:06 PDT by Justin Fan
Modified: 2020-07-30 16:26 PDT (History)
13 users (show)

See Also:


Attachments
Patch (4.91 KB, patch)
2020-07-22 20:03 PDT, Justin Fan
darin: review+
Details | Formatted Diff | Diff

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