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

@ -736,25 +736,18 @@ where
ref value,
operator,
case_sensitivity,
never_matches,
} => {
if never_matches {
return false;
}
element.attr_matches(
&NamespaceConstraint::Specific(&crate::parser::namespace_empty_string::<E::Impl>()),
local_name,
&AttrSelectorOperation::WithValue {
operator,
case_sensitivity: to_unconditional_case_sensitivity(case_sensitivity, element),
expected_value: value,
value,
},
)
},
Component::AttributeOther(ref attr_sel) => {
if attr_sel.never_matches {
return false;
}
let empty_string;
let namespace = match attr_sel.namespace() {
Some(ns) => ns,
@ -771,14 +764,14 @@ where
ParsedAttrSelectorOperation::WithValue {
operator,
case_sensitivity,
ref expected_value,
ref value,
} => AttrSelectorOperation::WithValue {
operator,
case_sensitivity: to_unconditional_case_sensitivity(
case_sensitivity,
element,
),
expected_value,
value,
},
},
)