Struct style::stylesheets::PageSelector
source · pub struct PageSelector {
pub name: AtomIdent,
pub pseudos: SmallVec<[PagePseudoClass; 4]>,
}
Expand description
Type of a single [@page
][page selector]
Fields§
§name: AtomIdent
Page name
https://drafts.csswg.org/css-page-3/#page-type-selector
pseudos: SmallVec<[PagePseudoClass; 4]>
Pseudo-classes for @page
Implementations§
source§impl PageSelector
impl PageSelector
sourcepub fn ident_matches(&self, other: &CustomIdent) -> bool
pub fn ident_matches(&self, other: &CustomIdent) -> bool
Checks if the ident matches a page-name’s ident.
This does not take pseudo selectors into account.
sourcepub fn matches(&self, name: &CustomIdent, flags: PagePseudoClassFlags) -> bool
pub fn matches(&self, name: &CustomIdent, flags: PagePseudoClassFlags) -> bool
Checks that this selector matches the ident and all pseudo classes are present in the provided flags.
sourcepub fn flags_match(&self, flags: PagePseudoClassFlags) -> bool
pub fn flags_match(&self, flags: PagePseudoClassFlags) -> bool
Checks that all pseudo classes in this selector are present in the provided flags.
Equivalent to, but may be more efficient than:
match_specificity(flags).is_some()
sourcepub fn match_specificity(&self, flags: PagePseudoClassFlags) -> Option<u32>
pub fn match_specificity(&self, flags: PagePseudoClassFlags) -> Option<u32>
Implements specificity calculation for a page selector given a set of page pseudo-classes to match with. If this selector includes any pseudo-classes that are not in the flags, then this will return None.
To fit the specificity calculation into a 32-bit value, this limits the maximum count of :first and :blank to 32767, and the maximum count of :left and :right to 65535.
https://drafts.csswg.org/css-page-3/#cascading-and-page-context
Trait Implementations§
source§impl Clone for PageSelector
impl Clone for PageSelector
source§fn clone(&self) -> PageSelector
fn clone(&self) -> PageSelector
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PageSelector
impl Debug for PageSelector
source§impl MallocSizeOf for PageSelector
impl MallocSizeOf for PageSelector
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
source§impl Parse for PageSelector
impl Parse for PageSelector
source§fn parse<'i, 't>(
_context: &ParserContext<'_>,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>>
fn parse<'i, 't>( _context: &ParserContext<'_>, input: &mut Parser<'i, 't>, ) -> Result<Self, ParseError<'i>>
source§impl ToCss for PageSelector
impl ToCss for PageSelector
source§impl ToShmem for PageSelector
impl ToShmem for PageSelector
Auto Trait Implementations§
impl Freeze for PageSelector
impl RefUnwindSafe for PageSelector
impl Send for PageSelector
impl Sync for PageSelector
impl Unpin for PageSelector
impl UnwindSafe for PageSelector
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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>
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>
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