mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
style: Implement the functional :host(..) selector.
We could invalidate in a slightly more fine-grained way, but I don't think it's worth the churn vs. keeping the special-cases minimal. Bug: 1452640 Reviewed-by: xidorn MozReview-Commit-ID: 5DkQrgwg9GW
This commit is contained in:
parent
bfb9fe6159
commit
eaefaa890e
8 changed files with 82 additions and 47 deletions
|
@ -692,10 +692,10 @@ where
|
|||
match *selector {
|
||||
Component::Combinator(_) => unreachable!(),
|
||||
Component::Slotted(ref selector) => {
|
||||
// <slots> are never flattened tree slottables.
|
||||
!element.is_html_slot_element() &&
|
||||
element.assigned_slot().is_some() &&
|
||||
context.shared.nest(|context| {
|
||||
// <slots> are never flattened tree slottables.
|
||||
!element.is_html_slot_element() &&
|
||||
element.assigned_slot().is_some() &&
|
||||
matches_complex_selector(
|
||||
selector.iter(),
|
||||
element,
|
||||
|
@ -814,8 +814,18 @@ where
|
|||
flags_setter(element, ElementSelectorFlags::HAS_EMPTY_SELECTOR);
|
||||
element.is_empty()
|
||||
}
|
||||
Component::Host => {
|
||||
context.shared.shadow_host().map_or(false, |host| host == element.opaque())
|
||||
Component::Host(ref selector) => {
|
||||
context.shared.shadow_host().map_or(false, |host| host == element.opaque()) &&
|
||||
selector.as_ref().map_or(true, |selector| {
|
||||
context.shared.nest(|context| {
|
||||
matches_complex_selector(
|
||||
selector.iter(),
|
||||
element,
|
||||
context,
|
||||
flags_setter,
|
||||
)
|
||||
})
|
||||
})
|
||||
}
|
||||
Component::Scope => {
|
||||
match context.shared.scope_element {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue