Hide servo internal shadow roots from the inspector by default (#35958)

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2025-03-13 14:08:24 +01:00 committed by GitHub
parent 4a9967725f
commit e627ac5cfd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 27 additions and 4 deletions

View file

@ -35,6 +35,7 @@ use selectors::matching::{
};
use selectors::parser::SelectorList;
use servo_arc::Arc;
use servo_config::pref;
use servo_url::ServoUrl;
use smallvec::SmallVec;
use style::context::QuirksMode;
@ -1209,9 +1210,12 @@ impl Node {
let host = maybe_shadow_root
.map(ShadowRoot::Host)
.map(|host| host.upcast::<Node>().unique_id());
let is_shadow_host = self
.downcast::<Element>()
.is_some_and(Element::is_shadow_host);
let is_shadow_host = self.downcast::<Element>().is_some_and(|potential_host| {
let Some(root) = potential_host.shadow_root() else {
return false;
};
!root.is_user_agent_widget() || pref!(inspector_show_servo_internal_shadow_roots)
});
let num_children = if is_shadow_host {
// Shadow roots count as children