style: Invalidate shadow part pseudo-class styles correctly.

I was going to send a test for `:focus` via wpt, but then realized it was
probably not spec-compliant with the new rules people want to follow for
:focus, so I filed https://github.com/w3c/csswg-drafts/issues/4555 instead.

Testing `:hover` / `:active` via wpt looked quite a bit of a hassle.

Differential Revision: https://phabricator.services.mozilla.com/D55591
This commit is contained in:
Emilio Cobos Álvarez 2019-12-09 13:40:16 +00:00
parent 6973317a58
commit 7cd59da2a0
3 changed files with 53 additions and 4 deletions

View file

@ -1889,18 +1889,33 @@ impl CascadeData {
self.host_rules.as_ref().and_then(|d| d.rules(pseudo))
}
/// Whether there's any host rule that could match in this scope.
pub fn any_host_rules(&self) -> bool {
self.host_rules.is_some()
}
/// Returns the slotted rule map for a given pseudo-element.
#[inline]
pub fn slotted_rules(&self, pseudo: Option<&PseudoElement>) -> Option<&SelectorMap<Rule>> {
self.slotted_rules.as_ref().and_then(|d| d.rules(pseudo))
}
/// Whether there's any ::slotted rule that could match in this scope.
pub fn any_slotted_rule(&self) -> bool {
self.slotted_rules.is_some()
}
/// Returns the parts rule map for a given pseudo-element.
#[inline]
pub fn part_rules(&self, pseudo: Option<&PseudoElement>) -> Option<&PartMap> {
self.part_rules.as_ref().and_then(|d| d.rules(pseudo))
}
/// Whether there's any ::part rule that could match in this scope.
pub fn any_part_rule(&self) -> bool {
self.part_rules.is_some()
}
/// Collects all the applicable media query results into `results`.
///
/// This duplicates part of the logic in `add_stylesheet`, which is