mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Bind/unbind shadow host children to/from tree
This commit is contained in:
parent
df81debffc
commit
1b036355ce
2 changed files with 29 additions and 2 deletions
|
@ -2784,6 +2784,16 @@ impl VirtualMethods for Element {
|
|||
return;
|
||||
}
|
||||
|
||||
if self.is_shadow_host() {
|
||||
let shadow_root = self.shadow_root.get().unwrap();
|
||||
let shadow_root = shadow_root.upcast::<Node>();
|
||||
shadow_root.set_flag(NodeFlags::IS_CONNECTED, tree_connected);
|
||||
for node in shadow_root.children() {
|
||||
node.set_flag(NodeFlags::IS_CONNECTED, tree_connected);
|
||||
node.bind_to_tree(tree_connected);
|
||||
}
|
||||
}
|
||||
|
||||
let doc = document_from_node(self);
|
||||
if let Some(ref value) = *self.id_attribute.borrow() {
|
||||
doc.register_named_element(self, value.clone());
|
||||
|
@ -2803,6 +2813,16 @@ impl VirtualMethods for Element {
|
|||
return;
|
||||
}
|
||||
|
||||
if self.is_shadow_host() {
|
||||
let shadow_root = self.shadow_root.get().unwrap();
|
||||
let shadow_root = shadow_root.upcast::<Node>();
|
||||
shadow_root.set_flag(NodeFlags::IS_CONNECTED, false);
|
||||
for node in shadow_root.children() {
|
||||
node.set_flag(NodeFlags::IS_CONNECTED, false);
|
||||
node.unbind_from_tree(context);
|
||||
}
|
||||
}
|
||||
|
||||
let doc = document_from_node(self);
|
||||
let fullscreen = doc.GetFullscreenElement();
|
||||
if fullscreen.deref() == Some(self) {
|
||||
|
|
|
@ -643,7 +643,8 @@ impl Node {
|
|||
}
|
||||
|
||||
fn is_shadow_including_inclusive_ancestor_of(&self, node: &Node) -> bool {
|
||||
node.shadow_including_inclusive_ancestors().any(|ancestor| &*ancestor == self)
|
||||
node.shadow_including_inclusive_ancestors()
|
||||
.any(|ancestor| &*ancestor == self)
|
||||
}
|
||||
|
||||
pub fn following_siblings(&self) -> impl Iterator<Item = DomRoot<Node>> {
|
||||
|
@ -1117,7 +1118,13 @@ impl Node {
|
|||
return DomRoot::from_ref(&a);
|
||||
}
|
||||
|
||||
a = DomRoot::from_ref(a_root.downcast::<ShadowRoot>().unwrap().Host().upcast::<Node>());
|
||||
a = DomRoot::from_ref(
|
||||
a_root
|
||||
.downcast::<ShadowRoot>()
|
||||
.unwrap()
|
||||
.Host()
|
||||
.upcast::<Node>(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue