style: Shrink selectors::Component to 24 bytes.

This saves about 37 KiB of memory across the UA style sheets.

Bug: 1475197
Reviewed-by: emilio
This commit is contained in:
Cameron McCormack 2018-07-16 12:15:47 +10:00 committed by Emilio Cobos Álvarez
parent b05ace3e4a
commit 62419adaaa
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
12 changed files with 96 additions and 50 deletions

View file

@ -699,7 +699,6 @@ where
},
Component::AttributeInNoNamespace {
ref local_name,
ref local_name_lower,
ref value,
operator,
case_sensitivity,
@ -711,7 +710,7 @@ where
let is_html = element.is_html_element_in_html_document();
element.attr_matches(
&NamespaceConstraint::Specific(&::parser::namespace_empty_string::<E::Impl>()),
select_name(is_html, local_name, local_name_lower),
local_name,
&AttrSelectorOperation::WithValue {
operator: operator,
case_sensitivity: case_sensitivity.to_unconditional(is_html),
@ -724,8 +723,16 @@ where
return false;
}
let is_html = element.is_html_element_in_html_document();
let empty_string;
let namespace = match attr_sel.namespace() {
Some(ns) => ns,
None => {
empty_string = ::parser::namespace_empty_string::<E::Impl>();
NamespaceConstraint::Specific(&empty_string)
}
};
element.attr_matches(
&attr_sel.namespace(),
&namespace,
select_name(is_html, &attr_sel.local_name, &attr_sel.local_name_lower),
&match attr_sel.operation {
ParsedAttrSelectorOperation::Exists => AttrSelectorOperation::Exists,