mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
style: Add a way to optimize the "attribute in no namespace exists" check
Go through the slow path by default. No behavior change. Differential Revision: https://phabricator.services.mozilla.com/D180528
This commit is contained in:
parent
c36a22a97f
commit
54a783db17
2 changed files with 12 additions and 5 deletions
|
@ -730,11 +730,7 @@ where
|
|||
Component::AttributeInNoNamespaceExists {
|
||||
ref local_name,
|
||||
ref local_name_lower,
|
||||
} => element.attr_matches(
|
||||
&NamespaceConstraint::Specific(&crate::parser::namespace_empty_string::<E::Impl>()),
|
||||
select_name(element, local_name, local_name_lower),
|
||||
&AttrSelectorOperation::Exists,
|
||||
),
|
||||
} => element.has_attr_in_no_namespace(select_name(element, local_name, local_name_lower)),
|
||||
Component::AttributeInNoNamespace {
|
||||
ref local_name,
|
||||
ref value,
|
||||
|
|
|
@ -80,6 +80,17 @@ pub trait Element: Sized + Clone + Debug {
|
|||
operation: &AttrSelectorOperation<&<Self::Impl as SelectorImpl>::AttrValue>,
|
||||
) -> bool;
|
||||
|
||||
fn has_attr_in_no_namespace(
|
||||
&self,
|
||||
local_name: &<Self::Impl as SelectorImpl>::LocalName,
|
||||
) -> bool {
|
||||
self.attr_matches(
|
||||
&NamespaceConstraint::Specific(&crate::parser::namespace_empty_string::<Self::Impl>()),
|
||||
local_name,
|
||||
&AttrSelectorOperation::Exists,
|
||||
)
|
||||
}
|
||||
|
||||
fn match_non_ts_pseudo_class(
|
||||
&self,
|
||||
pc: &<Self::Impl as SelectorImpl>::NonTSPseudoClass,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue