pub struct SelectorParser<'a> {
    pub stylesheet_origin: Origin,
    pub namespaces: &'a Namespaces,
    pub url_data: &'a UrlExtraData,
    pub for_supports_rule: bool,
}
Expand description

Servo’s selector parser.

Fields§

§stylesheet_origin: Origin

The origin of the stylesheet we’re parsing.

§namespaces: &'a Namespaces

The namespace set of the stylesheet.

§url_data: &'a UrlExtraData

The extra URL data of the stylesheet, which is used to look up whether we are parsing a chrome:// URL style sheet.

§for_supports_rule: bool

Whether we’re parsing selectors for @supports

Implementations§

source§

impl<'a> SelectorParser<'a>

source

pub fn parse_author_origin_no_namespace<'i>( input: &'i str, url_data: &UrlExtraData ) -> Result<SelectorList<SelectorImpl>, ParseError<'i>>

Parse a selector list with an author origin and without taking into account namespaces.

This is used for some DOM APIs like querySelector.

source

pub fn in_user_agent_stylesheet(&self) -> bool

Whether we’re parsing selectors in a user-agent stylesheet.

source

pub fn chrome_rules_enabled(&self) -> bool

Whether we’re parsing selectors in a stylesheet that has chrome privilege.

Trait Implementations§

source§

impl<'a> MallocSizeOf for SelectorParser<'a>

source§

fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize

Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself.
source§

impl<'a, 'i> Parser<'i> for SelectorParser<'a>

§

type Impl = SelectorImpl

§

type Error = StyleParseErrorKind<'i>

source§

fn parse_non_ts_pseudo_class( &self, location: SourceLocation, name: CowRcStr<'i> ) -> Result<NonTSPseudoClass, ParseError<'i>>

This function can return an “Err” pseudo-element in order to support CSS2.1 pseudo-elements.
source§

fn parse_non_ts_functional_pseudo_class<'t>( &self, name: CowRcStr<'i>, parser: &mut CssParser<'i, 't>, after_part: bool ) -> Result<NonTSPseudoClass, ParseError<'i>>

source§

fn parse_pseudo_element( &self, location: SourceLocation, name: CowRcStr<'i> ) -> Result<PseudoElement, ParseError<'i>>

source§

fn default_namespace(&self) -> Option<Namespace>

source§

fn namespace_for_prefix(&self, prefix: &Prefix) -> Option<Namespace>

source§

fn parse_slotted(&self) -> bool

Whether to parse the ::slotted() pseudo-element.
source§

fn parse_part(&self) -> bool

Whether to parse the ::part() pseudo-element.
source§

fn parse_nth_child_of(&self) -> bool

Whether to parse the selector list of nth-child() or nth-last-child().
source§

fn parse_is_and_where(&self) -> bool

Whether to parse the :where pseudo-class.
source§

fn parse_has(&self) -> bool

Whether to parse the :has pseudo-class.
source§

fn parse_parent_selector(&self) -> bool

Whether to parse the ‘&’ delimiter as a parent selector.
source§

fn is_is_alias(&self, _name: &str) -> bool

Whether the given function name is an alias for the :is() function.
source§

fn parse_host(&self) -> bool

Whether to parse the :host pseudo-class.
source§

fn allow_forgiving_selectors(&self) -> bool

Whether to allow forgiving selector-list parsing.
source§

fn parse_functional_pseudo_element<'t>( &self, name: CowRcStr<'i>, arguments: &mut Parser<'i, 't> ) -> Result<<Self::Impl as SelectorImpl>::PseudoElement, ParseError<'i, Self::Error>>

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for SelectorParser<'a>

§

impl<'a> Send for SelectorParser<'a>

§

impl<'a> Sync for SelectorParser<'a>

§

impl<'a> Unpin for SelectorParser<'a>

§

impl<'a> UnwindSafe for SelectorParser<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> MaybeBoxed<Box<T, Global>> for T

source§

fn maybe_boxed(self) -> Box<T, Global>

Convert
source§

impl<T> MaybeBoxed<T> for T

source§

fn maybe_boxed(self) -> T

Convert
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Erased for T

source§

impl<T> ErasedDestructor for Twhere T: 'static,

source§

impl<T> MaybeSendSync for T