mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Make traverse_preorder follow children of shadow hosts (#35276)
* Make traverse_preorder follow children of shadow hosts Children of shadow hosts are not displayed, but they still exist in the DOM and must be traversed. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Fix traverse_preorder over shadow roots Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update WPT expectations Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
parent
3a75e1205b
commit
aa09e2b88f
17 changed files with 25 additions and 185 deletions
|
@ -1778,6 +1778,14 @@ impl TreeIterator {
|
|||
self.current = Some(next_sibling);
|
||||
return Some(current);
|
||||
}
|
||||
if let Some(shadow_root) = ancestor.downcast::<ShadowRoot>() {
|
||||
// Shadow roots don't have sibling, so after we're done traversing
|
||||
// one we jump to the first child of the host
|
||||
if let Some(child) = shadow_root.Host().upcast::<Node>().GetFirstChild() {
|
||||
self.current = Some(child);
|
||||
return Some(current);
|
||||
}
|
||||
}
|
||||
self.depth -= 1;
|
||||
}
|
||||
debug_assert_eq!(self.depth, 0);
|
||||
|
@ -1801,8 +1809,6 @@ impl Iterator for TreeIterator {
|
|||
self.current = Some(DomRoot::from_ref(shadow_root.upcast::<Node>()));
|
||||
self.depth += 1;
|
||||
return Some(current);
|
||||
} else {
|
||||
return self.next_skipping_children_impl(current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue