style: fix invalidation of sibling combinators in different slots

This extends the code to deal with sibling invalidation to handle the
case where the flat tree doesn't match the DOM tree. In the test-case
for example, dom is:

  * details
    * summary id=a
    * summary

But flat tree is:

  * details
  * slot
    * summary id=a
  * slot
    * summary

Differential Revision: https://phabricator.services.mozilla.com/D159150
This commit is contained in:
Emilio Cobos Álvarez 2022-10-20 08:39:18 +00:00 committed by Martin Robinson
parent 6cb665df95
commit f14f1fa440
6 changed files with 66 additions and 11 deletions

View file

@ -211,6 +211,18 @@ pub trait TNode: Sized + Copy + Clone + Debug + NodeInfo + PartialEq {
self.parent_node().and_then(|n| n.as_element())
}
/// Get this node's parent element, or shadow host if it's a shadow root.
fn parent_element_or_host(&self) -> Option<Self::ConcreteElement> {
let parent = self.parent_node()?;
if let Some(e) = parent.as_element() {
return Some(e);
}
if let Some(root) = parent.as_shadow_root() {
return Some(root.host());
}
None
}
/// Converts self into an `OpaqueNode`.
fn opaque(&self) -> OpaqueNode;