Fix Stylist::lazily_compute_pseudo_element_style to return None when it should.

We have a fast path to return None if we have no rules for the pseudo-element at
all, but we should also return None if we have no _matching_ rules for it for
the given originating element.  This is relied on by consumers like
Servo_ResolvePseudoStyle, which needs to be able to detect the "no styles for
this pseudo-element for this originating element case", to support probing for
whether work for a specific pseudo-element should be done at all.
This commit is contained in:
Boris Zbarsky 2017-04-27 15:53:38 -04:00
parent 2c445169ad
commit c9fd747e69

View file

@ -534,6 +534,10 @@ impl Stylist {
&mut declarations,
&mut set_selector_flags);
if declarations.is_empty() {
return None
}
let rule_node =
self.rule_tree.insert_ordered_rules(
declarations.into_iter().map(|a| (a.source, a.level)));