Further changes required by Servo

This commit is contained in:
Oriol Brufau 2023-08-17 03:10:59 +02:00 committed by Martin Robinson
parent 3d0cf4dbf9
commit f0b7f3aca2
3 changed files with 19 additions and 3 deletions

View file

@ -695,9 +695,9 @@ where
Component::Slotted(ref selector) | Component::Host(Some(ref selector)) => { Component::Slotted(ref selector) | Component::Host(Some(ref selector)) => {
selector.size_of(ops) selector.size_of(ops)
}, },
Component::Is(ref list) | Component::Is(ref list) | Component::Where(ref list) | Component::Has(ref list) => {
Component::Where(ref list) | list.size_of(ops)
Component::Has(ref list) => list.size_of(ops), },
Component::PseudoElement(ref pseudo) => (*pseudo).size_of(ops), Component::PseudoElement(ref pseudo) => (*pseudo).size_of(ops),
Component::Combinator(..) | Component::Combinator(..) |
Component::ExplicitAnyNamespace | Component::ExplicitAnyNamespace |

View file

@ -3178,6 +3178,10 @@ impl<'a> SelectorsElement for DomRoot<Element> {
.next() .next()
} }
fn first_element_child(&self) -> Option<DomRoot<Element>> {
self.GetFirstElementChild()
}
fn attr_matches( fn attr_matches(
&self, &self,
ns: &NamespaceConstraint<&style::Namespace>, ns: &NamespaceConstraint<&style::Namespace>,

View file

@ -506,6 +506,12 @@ impl<'dom, LayoutDataType: LayoutDataTrait> ::selectors::Element
None None
} }
fn first_element_child(&self) -> Option<Self> {
self.as_node()
.dom_children()
.find_map(|child| child.as_element())
}
fn attr_matches( fn attr_matches(
&self, &self,
ns: &NamespaceConstraint<&style::Namespace>, ns: &NamespaceConstraint<&style::Namespace>,
@ -801,6 +807,12 @@ impl<'dom, LayoutDataType: LayoutDataTrait> ::selectors::Element
None None
} }
// Skips non-element nodes
fn first_element_child(&self) -> Option<Self> {
warn!("ServoThreadSafeLayoutElement::first_element_child called");
None
}
fn is_html_slot_element(&self) -> bool { fn is_html_slot_element(&self) -> bool {
self.element.is_html_slot_element() self.element.is_html_slot_element()
} }