DevTools: Show HTML tree (#32655)

* feat: watch root node

Signed-off-by: eri <eri@inventati.org>

* reafactor: divide inspector in components

Signed-off-by: eri <eri@inventati.org>

* feat: add css properties actor

Signed-off-by: eri <eri@inventati.org>

* feat: accesibility actor

Signed-off-by: eri <eri@inventati.org>

* feat: layout actor

Signed-off-by: eri <eri@inventati.org>

* feat: network parent and refactor

Signed-off-by: eri <eri@inventati.org>

* feat: progress on the inspector messages

Signed-off-by: eri <eri@inventati.org>

* feat: more progress on inspector

Signed-off-by: eri <eri@inventati.org>

* feat: try to fix nodes showing

Signed-off-by: eri <eri@inventati.org>

* feat: initial dom tree

Signed-off-by: eri <eri@inventati.org>

* feat: some more messages

Signed-off-by: eri <eri@inventati.org>

* feat: clean and add documentation

Signed-off-by: eri <eri@inventati.org>

* refactor: add more docs and clean

Signed-off-by: eri <eri@inventati.org>

* fix: restore deleted node attributes field

Signed-off-by: eri <eri@inventati.org>

* Apply suggestions from code review

Fix a few nits in comments

Signed-off-by: Martin Robinson <mrobinson@igalia.com>

---------

Signed-off-by: eri <eri@inventati.org>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
eri 2024-07-26 17:17:54 +02:00 committed by GitHub
parent f7448b5d61
commit 902bf57331
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 1487 additions and 833 deletions

View file

@ -28,7 +28,7 @@ use devtools_traits::{
};
use embedder_traits::{EmbedderMsg, EmbedderProxy, PromptDefinition, PromptOrigin, PromptResult};
use ipc_channel::ipc::{self, IpcSender};
use log::{debug, warn};
use log::{debug, trace, warn};
use serde::Serialize;
use servo_rand::RngCore;
@ -50,10 +50,8 @@ mod actor;
/// <https://searchfox.org/mozilla-central/source/devtools/server/actors>
mod actors {
pub mod browsing_context;
pub mod configuration;
pub mod console;
pub mod device;
pub mod emulation;
pub mod framerate;
pub mod inspector;
pub mod memory;
@ -62,7 +60,7 @@ mod actors {
pub mod performance;
pub mod preference;
pub mod process;
pub mod profiler;
pub mod reflow;
pub mod root;
pub mod stylesheets;
pub mod tab;
@ -279,6 +277,7 @@ fn run_server(
// We need separate actor representations for each script global that exists;
// clients can theoretically connect to multiple globals simultaneously.
// TODO: move this into the root or target modules?
#[allow(clippy::too_many_arguments)]
fn handle_new_global(
actors: Arc<Mutex<ActorRegistry>>,
ids: (BrowsingContextId, PipelineId, Option<WorkerId>),
@ -608,7 +607,7 @@ fn run_server(
let mut next_id = StreamId(0);
while let Ok(msg) = receiver.recv() {
debug!("{:?}", msg);
trace!("{:?}", msg);
match msg {
DevtoolsControlMsg::FromChrome(ChromeToDevtoolsControlMsg::AddClient(stream)) => {
let actors = actors.clone();