Struct style::selector_parser::SelectorParser
source · 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>
impl<'a> SelectorParser<'a>
Parse a selector list with an author origin and without taking into account namespaces.
This is used for some DOM APIs like querySelector
.
sourcepub fn in_user_agent_stylesheet(&self) -> bool
pub fn in_user_agent_stylesheet(&self) -> bool
Whether we’re parsing selectors in a user-agent stylesheet.
sourcepub fn chrome_rules_enabled(&self) -> bool
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>
impl<'a> MallocSizeOf for SelectorParser<'a>
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
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>
impl<'a, 'i> Parser<'i> for SelectorParser<'a>
type Impl = SelectorImpl
type Error = StyleParseErrorKind<'i>
source§fn parse_nth_child_of(&self) -> bool
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
fn parse_is_and_where(&self) -> bool
Whether to parse
:is
and :where
pseudo-classes.source§fn parse_parent_selector(&self) -> bool
fn parse_parent_selector(&self) -> bool
Whether to parse the ‘&’ delimiter as a parent selector.
source§fn allow_forgiving_selectors(&self) -> bool
fn allow_forgiving_selectors(&self) -> bool
Whether to allow forgiving selector-list parsing.
source§fn parse_non_ts_pseudo_class(
&self,
location: SourceLocation,
name: CowRcStr<'i>,
) -> Result<NonTSPseudoClass, ParseError<'i>>
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.
fn parse_non_ts_functional_pseudo_class<'t>( &self, name: CowRcStr<'i>, parser: &mut CssParser<'i, 't>, after_part: bool, ) -> Result<NonTSPseudoClass, ParseError<'i>>
fn parse_pseudo_element( &self, location: SourceLocation, name: CowRcStr<'i>, ) -> Result<PseudoElement, ParseError<'i>>
fn default_namespace(&self) -> Option<Namespace>
fn namespace_for_prefix(&self, prefix: &Prefix) -> Option<Namespace>
source§fn parse_slotted(&self) -> bool
fn parse_slotted(&self) -> bool
Whether to parse the
::slotted()
pseudo-element.source§fn parse_part(&self) -> bool
fn parse_part(&self) -> bool
Whether to parse the
::part()
pseudo-element.source§fn is_is_alias(&self, _name: &str) -> bool
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
fn parse_host(&self) -> bool
Whether to parse the
:host
pseudo-class.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> Freeze for SelectorParser<'a>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moresource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert