mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Strip out shmem for publishing.
This commit is contained in:
parent
f183d66217
commit
7fea21d888
6 changed files with 22 additions and 40 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -4654,8 +4654,6 @@ dependencies = [
|
||||||
"servo_arc",
|
"servo_arc",
|
||||||
"smallvec 1.0.0",
|
"smallvec 1.0.0",
|
||||||
"thin-slice",
|
"thin-slice",
|
||||||
"to_shmem",
|
|
||||||
"to_shmem_derive",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
@ -31,8 +31,6 @@ precomputed-hash = "0.1"
|
||||||
servo_arc = { version = "0.1", path = "../servo_arc" }
|
servo_arc = { version = "0.1", path = "../servo_arc" }
|
||||||
smallvec = "1.0"
|
smallvec = "1.0"
|
||||||
thin-slice = "0.1.0"
|
thin-slice = "0.1.0"
|
||||||
to_shmem = { path = "../to_shmem" }
|
|
||||||
to_shmem_derive = { path = "../to_shmem_derive" }
|
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
phf_codegen = "0.8"
|
phf_codegen = "0.8"
|
||||||
|
|
|
@ -6,15 +6,11 @@ use crate::parser::SelectorImpl;
|
||||||
use cssparser::ToCss;
|
use cssparser::ToCss;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
#[derive(Clone, Eq, PartialEq, ToShmem)]
|
#[derive(Clone, Eq, PartialEq)]
|
||||||
#[shmem(no_bounds)]
|
|
||||||
pub struct AttrSelectorWithOptionalNamespace<Impl: SelectorImpl> {
|
pub struct AttrSelectorWithOptionalNamespace<Impl: SelectorImpl> {
|
||||||
#[shmem(field_bound)]
|
|
||||||
pub namespace: Option<NamespaceConstraint<(Impl::NamespacePrefix, Impl::NamespaceUrl)>>,
|
pub namespace: Option<NamespaceConstraint<(Impl::NamespacePrefix, Impl::NamespaceUrl)>>,
|
||||||
#[shmem(field_bound)]
|
|
||||||
pub local_name: Impl::LocalName,
|
pub local_name: Impl::LocalName,
|
||||||
pub local_name_lower: Impl::LocalName,
|
pub local_name_lower: Impl::LocalName,
|
||||||
#[shmem(field_bound)]
|
|
||||||
pub operation: ParsedAttrSelectorOperation<Impl::AttrValue>,
|
pub operation: ParsedAttrSelectorOperation<Impl::AttrValue>,
|
||||||
pub never_matches: bool,
|
pub never_matches: bool,
|
||||||
}
|
}
|
||||||
|
@ -28,7 +24,7 @@ impl<Impl: SelectorImpl> AttrSelectorWithOptionalNamespace<Impl> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Eq, PartialEq, ToShmem)]
|
#[derive(Clone, Eq, PartialEq)]
|
||||||
pub enum NamespaceConstraint<NamespaceUrl> {
|
pub enum NamespaceConstraint<NamespaceUrl> {
|
||||||
Any,
|
Any,
|
||||||
|
|
||||||
|
@ -36,7 +32,7 @@ pub enum NamespaceConstraint<NamespaceUrl> {
|
||||||
Specific(NamespaceUrl),
|
Specific(NamespaceUrl),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Eq, PartialEq, ToShmem)]
|
#[derive(Clone, Eq, PartialEq)]
|
||||||
pub enum ParsedAttrSelectorOperation<AttrValue> {
|
pub enum ParsedAttrSelectorOperation<AttrValue> {
|
||||||
Exists,
|
Exists,
|
||||||
WithValue {
|
WithValue {
|
||||||
|
@ -76,7 +72,7 @@ impl<AttrValue> AttrSelectorOperation<AttrValue> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Eq, PartialEq, ToShmem)]
|
#[derive(Clone, Copy, Eq, PartialEq)]
|
||||||
pub enum AttrSelectorOperator {
|
pub enum AttrSelectorOperator {
|
||||||
Equal,
|
Equal,
|
||||||
Includes,
|
Includes,
|
||||||
|
@ -136,7 +132,7 @@ impl AttrSelectorOperator {
|
||||||
/// The definition of whitespace per CSS Selectors Level 3 § 4.
|
/// The definition of whitespace per CSS Selectors Level 3 § 4.
|
||||||
pub static SELECTOR_WHITESPACE: &'static [char] = &[' ', '\t', '\n', '\r', '\x0C'];
|
pub static SELECTOR_WHITESPACE: &'static [char] = &[' ', '\t', '\n', '\r', '\x0C'];
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToShmem)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||||
pub enum ParsedCaseSensitivity {
|
pub enum ParsedCaseSensitivity {
|
||||||
// 's' was specified.
|
// 's' was specified.
|
||||||
ExplicitCaseSensitive,
|
ExplicitCaseSensitive,
|
||||||
|
|
|
@ -193,7 +193,7 @@ fn split_from_end<T>(s: &[T], at: usize) -> (&[T], &[T]) {
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
/// Flags that indicate at which point of parsing a selector are we.
|
/// Flags that indicate at which point of parsing a selector are we.
|
||||||
#[derive(Default, ToShmem)]
|
#[derive(Default)]
|
||||||
pub (crate) struct SelectorFlags : u8 {
|
pub (crate) struct SelectorFlags : u8 {
|
||||||
const HAS_PSEUDO = 1 << 0;
|
const HAS_PSEUDO = 1 << 0;
|
||||||
const HAS_SLOTTED = 1 << 1;
|
const HAS_SLOTTED = 1 << 1;
|
||||||
|
@ -201,7 +201,7 @@ bitflags! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToShmem)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||||
pub struct SpecificityAndFlags {
|
pub struct SpecificityAndFlags {
|
||||||
/// There are two free bits here, since we use ten bits for each specificity
|
/// There are two free bits here, since we use ten bits for each specificity
|
||||||
/// kind (id, class, element).
|
/// kind (id, class, element).
|
||||||
|
|
|
@ -21,9 +21,6 @@ extern crate precomputed_hash;
|
||||||
extern crate servo_arc;
|
extern crate servo_arc;
|
||||||
extern crate smallvec;
|
extern crate smallvec;
|
||||||
extern crate thin_slice;
|
extern crate thin_slice;
|
||||||
extern crate to_shmem;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate to_shmem_derive;
|
|
||||||
|
|
||||||
pub mod attr;
|
pub mod attr;
|
||||||
pub mod bloom;
|
pub mod bloom;
|
||||||
|
|
|
@ -293,10 +293,9 @@ pub trait Parser<'i> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, ToShmem)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
#[shmem(no_bounds)]
|
|
||||||
pub struct SelectorList<Impl: SelectorImpl>(
|
pub struct SelectorList<Impl: SelectorImpl>(
|
||||||
#[shmem(field_bound)] pub SmallVec<[Selector<Impl>; 1]>,
|
pub SmallVec<[Selector<Impl>; 1]>,
|
||||||
);
|
);
|
||||||
|
|
||||||
impl<Impl: SelectorImpl> SelectorList<Impl> {
|
impl<Impl: SelectorImpl> SelectorList<Impl> {
|
||||||
|
@ -582,10 +581,9 @@ pub fn namespace_empty_string<Impl: SelectorImpl>() -> Impl::NamespaceUrl {
|
||||||
///
|
///
|
||||||
/// This reordering doesn't change the semantics of selector matching, and we
|
/// This reordering doesn't change the semantics of selector matching, and we
|
||||||
/// handle it in to_css to make it invisible to serialization.
|
/// handle it in to_css to make it invisible to serialization.
|
||||||
#[derive(Clone, Eq, PartialEq, ToShmem)]
|
#[derive(Clone, Eq, PartialEq)]
|
||||||
#[shmem(no_bounds)]
|
|
||||||
pub struct Selector<Impl: SelectorImpl>(
|
pub struct Selector<Impl: SelectorImpl>(
|
||||||
#[shmem(field_bound)] ThinArc<SpecificityAndFlags, Component<Impl>>,
|
ThinArc<SpecificityAndFlags, Component<Impl>>,
|
||||||
);
|
);
|
||||||
|
|
||||||
impl<Impl: SelectorImpl> Selector<Impl> {
|
impl<Impl: SelectorImpl> Selector<Impl> {
|
||||||
|
@ -890,7 +888,7 @@ impl<'a, Impl: SelectorImpl> Iterator for AncestorIter<'a, Impl> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToShmem)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||||
pub enum Combinator {
|
pub enum Combinator {
|
||||||
Child, // >
|
Child, // >
|
||||||
Descendant, // space
|
Descendant, // space
|
||||||
|
@ -941,27 +939,25 @@ impl Combinator {
|
||||||
/// optimal packing and cache performance, see [1].
|
/// optimal packing and cache performance, see [1].
|
||||||
///
|
///
|
||||||
/// [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1357973
|
/// [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1357973
|
||||||
#[derive(Clone, Eq, PartialEq, ToShmem)]
|
#[derive(Clone, Eq, PartialEq)]
|
||||||
#[shmem(no_bounds)]
|
|
||||||
pub enum Component<Impl: SelectorImpl> {
|
pub enum Component<Impl: SelectorImpl> {
|
||||||
Combinator(Combinator),
|
Combinator(Combinator),
|
||||||
|
|
||||||
ExplicitAnyNamespace,
|
ExplicitAnyNamespace,
|
||||||
ExplicitNoNamespace,
|
ExplicitNoNamespace,
|
||||||
DefaultNamespace(#[shmem(field_bound)] Impl::NamespaceUrl),
|
DefaultNamespace(Impl::NamespaceUrl),
|
||||||
Namespace(
|
Namespace(
|
||||||
#[shmem(field_bound)] Impl::NamespacePrefix,
|
Impl::NamespacePrefix,
|
||||||
#[shmem(field_bound)] Impl::NamespaceUrl,
|
Impl::NamespaceUrl,
|
||||||
),
|
),
|
||||||
|
|
||||||
ExplicitUniversalType,
|
ExplicitUniversalType,
|
||||||
LocalName(LocalName<Impl>),
|
LocalName(LocalName<Impl>),
|
||||||
|
|
||||||
ID(#[shmem(field_bound)] Impl::Identifier),
|
ID(Impl::Identifier),
|
||||||
Class(#[shmem(field_bound)] Impl::ClassName),
|
Class(Impl::ClassName),
|
||||||
|
|
||||||
AttributeInNoNamespaceExists {
|
AttributeInNoNamespaceExists {
|
||||||
#[shmem(field_bound)]
|
|
||||||
local_name: Impl::LocalName,
|
local_name: Impl::LocalName,
|
||||||
local_name_lower: Impl::LocalName,
|
local_name_lower: Impl::LocalName,
|
||||||
},
|
},
|
||||||
|
@ -969,7 +965,6 @@ pub enum Component<Impl: SelectorImpl> {
|
||||||
AttributeInNoNamespace {
|
AttributeInNoNamespace {
|
||||||
local_name: Impl::LocalName,
|
local_name: Impl::LocalName,
|
||||||
operator: AttrSelectorOperator,
|
operator: AttrSelectorOperator,
|
||||||
#[shmem(field_bound)]
|
|
||||||
value: Impl::AttrValue,
|
value: Impl::AttrValue,
|
||||||
case_sensitivity: ParsedCaseSensitivity,
|
case_sensitivity: ParsedCaseSensitivity,
|
||||||
never_matches: bool,
|
never_matches: bool,
|
||||||
|
@ -1001,7 +996,7 @@ pub enum Component<Impl: SelectorImpl> {
|
||||||
FirstOfType,
|
FirstOfType,
|
||||||
LastOfType,
|
LastOfType,
|
||||||
OnlyOfType,
|
OnlyOfType,
|
||||||
NonTSPseudoClass(#[shmem(field_bound)] Impl::NonTSPseudoClass),
|
NonTSPseudoClass(Impl::NonTSPseudoClass),
|
||||||
/// The ::slotted() pseudo-element:
|
/// The ::slotted() pseudo-element:
|
||||||
///
|
///
|
||||||
/// https://drafts.csswg.org/css-scoping/#slotted-pseudo
|
/// https://drafts.csswg.org/css-scoping/#slotted-pseudo
|
||||||
|
@ -1016,7 +1011,7 @@ pub enum Component<Impl: SelectorImpl> {
|
||||||
Slotted(Selector<Impl>),
|
Slotted(Selector<Impl>),
|
||||||
/// The `::part` pseudo-element.
|
/// The `::part` pseudo-element.
|
||||||
/// https://drafts.csswg.org/css-shadow-parts/#part
|
/// https://drafts.csswg.org/css-shadow-parts/#part
|
||||||
Part(#[shmem(field_bound)] Box<[Impl::PartName]>),
|
Part(Box<[Impl::PartName]>),
|
||||||
/// The `:host` pseudo-class:
|
/// The `:host` pseudo-class:
|
||||||
///
|
///
|
||||||
/// https://drafts.csswg.org/css-scoping/#host-selector
|
/// https://drafts.csswg.org/css-scoping/#host-selector
|
||||||
|
@ -1027,7 +1022,7 @@ pub enum Component<Impl: SelectorImpl> {
|
||||||
///
|
///
|
||||||
/// See https://github.com/w3c/csswg-drafts/issues/2158
|
/// See https://github.com/w3c/csswg-drafts/issues/2158
|
||||||
Host(Option<Selector<Impl>>),
|
Host(Option<Selector<Impl>>),
|
||||||
PseudoElement(#[shmem(field_bound)] Impl::PseudoElement),
|
PseudoElement(Impl::PseudoElement),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Impl: SelectorImpl> Component<Impl> {
|
impl<Impl: SelectorImpl> Component<Impl> {
|
||||||
|
@ -1082,10 +1077,8 @@ impl<Impl: SelectorImpl> Component<Impl> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Eq, PartialEq, ToShmem)]
|
#[derive(Clone, Eq, PartialEq)]
|
||||||
#[shmem(no_bounds)]
|
|
||||||
pub struct LocalName<Impl: SelectorImpl> {
|
pub struct LocalName<Impl: SelectorImpl> {
|
||||||
#[shmem(field_bound)]
|
|
||||||
pub name: Impl::LocalName,
|
pub name: Impl::LocalName,
|
||||||
pub lower_name: Impl::LocalName,
|
pub lower_name: Impl::LocalName,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue