mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Retarget result of shadowRoot.element(s)FromPoint
This commit is contained in:
parent
8641866a50
commit
07e2f41c34
3 changed files with 30 additions and 10 deletions
|
@ -1123,14 +1123,16 @@ impl Node {
|
|||
}
|
||||
|
||||
/// https://dom.spec.whatwg.org/#retarget
|
||||
pub fn retarget(&self, a: &Node, b: &Node) -> DomRoot<Node> {
|
||||
let mut a = DomRoot::from_ref(&*a);
|
||||
pub fn retarget(&self, b: &Node) -> DomRoot<Node> {
|
||||
let mut a = DomRoot::from_ref(&*self);
|
||||
loop {
|
||||
// Step 1.
|
||||
let a_root = a.GetRootNode(&GetRootNodeOptions::empty());
|
||||
if !a_root.is::<ShadowRoot>() || a_root.is_shadow_including_inclusive_ancestor_of(b) {
|
||||
return DomRoot::from_ref(&a);
|
||||
}
|
||||
|
||||
// Step 2.
|
||||
a = DomRoot::from_ref(
|
||||
a_root
|
||||
.downcast::<ShadowRoot>()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue