mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Optimize Node::GetRootNode
This commit is contained in:
parent
8eba587547
commit
890297ef0a
1 changed files with 9 additions and 3 deletions
|
@ -2279,10 +2279,16 @@ impl NodeMethods for Node {
|
||||||
return shadow_root.Host().upcast::<Node>().GetRootNode(options);
|
return shadow_root.Host().upcast::<Node>().GetRootNode(options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if let Some(shadow_root) = self.rare_data.owner_shadow_root.get() {
|
||||||
|
DomRoot::from_ref(shadow_root.upcast::<Node>())
|
||||||
|
} else if self.is_in_doc() {
|
||||||
|
DomRoot::from_ref(self.owner_doc().upcast::<Node>())
|
||||||
|
} else {
|
||||||
self.inclusive_ancestors(ShadowIncluding::No)
|
self.inclusive_ancestors(ShadowIncluding::No)
|
||||||
.last()
|
.last()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#dom-node-parentnode
|
// https://dom.spec.whatwg.org/#dom-node-parentnode
|
||||||
fn GetParentNode(&self) -> Option<DomRoot<Node>> {
|
fn GetParentNode(&self) -> Option<DomRoot<Node>> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue