Repository navigation
feat(core): highlight and inspect views from DevTools - #11689
Draft
edusperoni wants to merge 4 commits into
Draft
edusperoni wants to merge 4 commits into
edusperoni wants to merge 4 commits into
Conversation
…the inspector Adds DOM.getBoxModel, DOM.getNodeForLocation and DOM.pushNodesByBackendIdsToFrontend. Box quads are in window DIPs, built from the view's location, size and effective margins, borders and paddings. Nodes now report backendNodeId equal to nodeId so the frontend can resolve backend ids from Overlay events and screencast inspect.
Implements Overlay.enable/disable, highlightNode, highlightRect, hideHighlight and setInspectMode, plus successful no-ops for the setShow* family and setPausedInDebuggerMessage that the frontend sends on attach. Highlights draw as colored content/padding/border/margin bands above the app: a non-interactive view on the window on iOS, the decor view's overlay on Android. They go away on hideHighlight or when the view unloads. In searchForNode mode a full-window view swallows touches: dragging highlights the view under the finger and emits Overlay.nodeHighlightRequested; lifting emits Overlay.inspectNodeRequested and leaves inspect mode on the device, since the frontend exits it locally without sending mode none. Overlay.enable resets the state so a reconnecting frontend never inherits a touch-blocking interceptor.
|
View your CI Pipeline Execution ↗ for commit 25bd9cd
💡 With Ultracache enabled, Nx Cloud learns each task's file inputs in CI and uses them on later runs. Turn on Ultracache in workspace settings ↗ · Read docs ↗ ☁️ Nx Cloud last updated this comment at |
commit: |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
I have read the CLA and I hereby sign the CLA).What is the current behavior?
The Elements panel shows the view tree, but there is no link between it and the screen. Chrome DevTools highlights and inspects through the
Overlaydomain, which core doesn't implement:Overlay.enablefails, hovering a node highlights nothing, and inspect mode does nothing.DOM.getBoxModel,DOM.getNodeForLocationandDOM.pushNodesByBackendIdsToFrontendfail too, and every node reportsbackendNodeId: 0, so the frontend can't map a backend node to the tree.There is also no way to get from a node in Elements to the view itself:
DOM.resolveNodeis a stub and$0is always undefined.What is the new behavior?
Highlight. Hovering a node in Elements highlights its view on the device, with margin, border, padding and content bands in the colors DevTools asks for. It clears when the pointer leaves or the view unloads.
Inspect. In inspect mode, touching the device highlights the view under the finger, and lifting it selects that view in Elements. The touch doesn't reach the app, and inspect mode ends after one pick.
Geometry for the frontend.
DOM.getBoxModelreturns margin, border, padding and content quads in window DIPs.DOM.getNodeForLocationreturns the deepest visible view at a point.DOM.pushNodesByBackendIdsToFrontendis implemented, and nodes now report abackendNodeIdequal to theirnodeId.References to views. The runtimes serialize domain handler results to JSON, so a handler can't return a remote object. DevTools clients get the view through
Runtime.evaluateinstead:$0is the node selected in Elements (DOM.setInspectedNode).__inspector.getViewById(nodeId)is the view behind a node id. A DevTools proxy can answerDOM.resolveNodewith it.__inspector.getRootView()is the app's root view, so tools such as Angular DevTools need no code in the app.Geometry and hit testing are shared code in
debugger/devtools-layout.ts. Drawing and touch interception are per platform indebugger/devtools-screen.{ios,android}.ts. Everything is loaded throughinspector_modules.Testing
core:testpasses (789 passed, 1 skipped), including 11 new tests for the box decomposition, highlight bands, hit testing and view references.core:buildpasses.$0and__inspector.getViewByIdgive the view.Known limitations
Overlay.enable. The debugger modules get no disconnect notification.DOM.resolveNodeitself is still a stub. Answering it natively needs a runtime change (V8InspectorSession::wrapObject).