Bug 199544

Summary: Layers visualization should show layer contents
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: Web InspectorAssignee: Simon Fraser (smfr) <simon.fraser>
Status: NEW ---    
Severity: Normal CC: ews-watchlist, hi, inspector-bugzilla-changes, joepeck, keith_miller, mark.lam, msaboff, pangle, ross.kirsling, saam, simon.fraser, tzagallo, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Non-working patch
none
Kinda working patch
none
WIP v0.1 - Rebase smfr patch, adjust texture UVs none

Description Simon Fraser (smfr) 2019-07-06 10:36:18 PDT
The layers 3D view needs to show images of the layer contents.
Comment 1 Radar WebKit Bug Importer 2019-07-06 12:54:44 PDT
<rdar://problem/52729705>
Comment 2 Simon Fraser (smfr) 2019-07-07 21:36:52 PDT
Created attachment 373615 [details]
Non-working patch
Comment 3 Simon Fraser (smfr) 2019-07-07 21:37:32 PDT
I could not get the material texture stuff to work.
Comment 4 Simon Fraser (smfr) 2019-07-09 21:41:14 PDT
Created attachment 373818 [details]
Kinda working patch
Comment 5 Simon Fraser (smfr) 2019-07-09 21:41:49 PDT
Comment on attachment 373818 [details]
Kinda working patch

This patch actually gets bits onto layers.
Comment 6 Patrick Angle 2021-06-16 09:36:27 PDT
Created attachment 431555 [details]
WIP v0.1 - Rebase smfr patch, adjust texture UVs
Comment 7 EWS Watchlist 2021-06-16 09:37:08 PDT
This patch modifies the inspector protocol. Please ensure that any frontend changes appropriately use feature checks for new protocol features.
Comment 8 Devin Rousso 2021-06-16 10:47:11 PDT
Comment on attachment 431555 [details]
WIP v0.1 - Rebase smfr patch, adjust texture UVs

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

> Source/JavaScriptCore/inspector/protocol/LayerTree.json:112
> +            "name": "imageForLayerContents",

Rather than having a separate command (which means we'd have a new call-and-response for each layer), I wonder if it'd be better to instead include a `{ "name": "content", "type": "string", "optional": true }` property inside `LayerTree.Layer` and have a `{ "name": "includeContent", "type": "boolean", "optional": true }` parameter for `LayerTree.layersForNode` so that we can instead just have a single command that has all the response in it.

I think there also may be a benefit of having a checkbox in the Layers Tab that controls whether image data is fetched (probably default enabled).  At least in the short term while evaluating the performance of this.

> Source/WebCore/inspector/agents/InspectorLayerTreeAgent.cpp:348
> +    return snapshot->toDataURL("image/png"_s, std::nullopt, PreserveResolution::Yes);

I wonder if we should consider lowering the `quality`.  Maybe only if the performance is really bad.

> Source/WebInspectorUI/UserInterface/Views/Layers3DContentView.js:297
> +        layerGroup.add(this._createLayerMesh(layer.compositedBounds), this._createLayerMesh(layer.compositedBounds, true));

o_0 why?