Whoops, the Layers tab is currently always throwing out the layer for the root element. (This means any worries about "no layers available" UX are moot...) This should be fixed in LayerTreeManager#layersForNode, as the API is currently overtailored to the legacy sidebar.
Created attachment 323542 [details] Patch
Comment on attachment 323542 [details] Patch Can you write a test for the manager level change?
It looks like there are protocol tests for LayerTree (which are not affected by this change) but no inspector tests for the manager. I'm really just trying to make the manager method a simple passthrough for the agent method -- do you know of an existing example where both get tested?
(In reply to Ross Kirsling from comment #3) > It looks like there are protocol tests for LayerTree (which are not affected > by this change) but no inspector tests for the manager. I'm really just > trying to make the manager method a simple passthrough for the agent method > -- do you know of an existing example where both get tested? Tests in LayoutTests/inspector/layers/ are protocol tests, so they don't use the manager. That said, all you need to do is borrow the same test content from those tests and dump out the layers for root node. Sorry to force you into writing tests, but we have to start somewhere. Fortunately there is test content you can already use.
Created attachment 323627 [details] Patch
Comment on attachment 323627 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=323627&action=review r=me > Source/WebInspectorUI/UserInterface/Views/LayerTreeDetailsSidebarPanel.js:83 > + let layerForNode = layers[0] && layers[0].nodeId === this.domNode.id && !layers[0].isGeneratedContent ? layers[0] : null; This is kind of complicated for one line, but that's okay I guess.
Comment on attachment 323627 [details] Patch Clearing flags on attachment: 323627 Committed r223428: <https://trac.webkit.org/changeset/223428>
All reviewed patches have been landed. Closing bug.
<rdar://problem/35013279>