mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
style: Make pseudo-elements work with :host.
Imported WebKit's test as a WPT. Bug: 1465291 Reviewed-by: xidorn MozReview-Commit-ID: 19ZThuoqKLW
This commit is contained in:
parent
8d069d127a
commit
8821ad72f4
2 changed files with 35 additions and 28 deletions
|
@ -544,10 +544,26 @@ impl<Impl: SelectorImpl> Selector<Impl> {
|
|||
}
|
||||
|
||||
/// Whether this selector is a featureless :host selector, with no
|
||||
/// combinators to the left.
|
||||
/// combinators to the left, and optionally has a pseudo-element to the
|
||||
/// right.
|
||||
#[inline]
|
||||
pub fn is_featureless_host_selector(&self) -> bool {
|
||||
self.iter().is_featureless_host_selector()
|
||||
pub fn is_featureless_host_selector_or_pseudo_element(&self) -> bool {
|
||||
let mut iter = self.iter();
|
||||
if !self.has_pseudo_element() {
|
||||
return iter.is_featureless_host_selector();
|
||||
}
|
||||
|
||||
// Skip the pseudo-element.
|
||||
for _ in &mut iter { }
|
||||
|
||||
match iter.next_sequence() {
|
||||
None => return false,
|
||||
Some(combinator) => {
|
||||
debug_assert_eq!(combinator, Combinator::PseudoElement);
|
||||
}
|
||||
}
|
||||
|
||||
iter.is_featureless_host_selector()
|
||||
}
|
||||
|
||||
/// Returns an iterator over this selector in matching order (right-to-left),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue