style: Remove the never_matches field from attr selectors

It's an extra branch which in practice we almost never take, plus extra
checks during parsing.

Differential Revision: https://phabricator.services.mozilla.com/D180529
This commit is contained in:
Emilio Cobos Álvarez 2023-06-14 21:08:22 +00:00 committed by Martin Robinson
parent 54a783db17
commit 3da2db1c53
5 changed files with 28 additions and 57 deletions

View file

@ -19,7 +19,6 @@ pub struct AttrSelectorWithOptionalNamespace<Impl: SelectorImpl> {
pub local_name_lower: Impl::LocalName,
#[cfg_attr(feature = "shmem", shmem(field_bound))]
pub operation: ParsedAttrSelectorOperation<Impl::AttrValue>,
pub never_matches: bool,
}
impl<Impl: SelectorImpl> AttrSelectorWithOptionalNamespace<Impl> {
@ -47,7 +46,7 @@ pub enum ParsedAttrSelectorOperation<AttrValue> {
WithValue {
operator: AttrSelectorOperator,
case_sensitivity: ParsedCaseSensitivity,
expected_value: AttrValue,
value: AttrValue,
},
}
@ -57,7 +56,7 @@ pub enum AttrSelectorOperation<AttrValue> {
WithValue {
operator: AttrSelectorOperator,
case_sensitivity: CaseSensitivity,
expected_value: AttrValue,
value: AttrValue,
},
}
@ -71,10 +70,10 @@ impl<AttrValue> AttrSelectorOperation<AttrValue> {
AttrSelectorOperation::WithValue {
operator,
case_sensitivity,
ref expected_value,
ref value,
} => operator.eval_str(
element_attr_value,
expected_value.as_ref(),
value.as_ref(),
case_sensitivity,
),
}