mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
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:
parent
b05ace3e4a
commit
62419adaaa
12 changed files with 96 additions and 50 deletions
|
@ -7,20 +7,20 @@ use parser::SelectorImpl;
|
|||
use std::fmt;
|
||||
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
pub struct AttrSelectorWithNamespace<Impl: SelectorImpl> {
|
||||
pub namespace: NamespaceConstraint<(Impl::NamespacePrefix, Impl::NamespaceUrl)>,
|
||||
pub struct AttrSelectorWithOptionalNamespace<Impl: SelectorImpl> {
|
||||
pub namespace: Option<NamespaceConstraint<(Impl::NamespacePrefix, Impl::NamespaceUrl)>>,
|
||||
pub local_name: Impl::LocalName,
|
||||
pub local_name_lower: Impl::LocalName,
|
||||
pub operation: ParsedAttrSelectorOperation<Impl::AttrValue>,
|
||||
pub never_matches: bool,
|
||||
}
|
||||
|
||||
impl<Impl: SelectorImpl> AttrSelectorWithNamespace<Impl> {
|
||||
pub fn namespace(&self) -> NamespaceConstraint<&Impl::NamespaceUrl> {
|
||||
match self.namespace {
|
||||
impl<Impl: SelectorImpl> AttrSelectorWithOptionalNamespace<Impl> {
|
||||
pub fn namespace(&self) -> Option<NamespaceConstraint<&Impl::NamespaceUrl>> {
|
||||
self.namespace.as_ref().map(|ns| match ns {
|
||||
NamespaceConstraint::Any => NamespaceConstraint::Any,
|
||||
NamespaceConstraint::Specific((_, ref url)) => NamespaceConstraint::Specific(url),
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue