Struct style::media_queries::MediaList
source · pub struct MediaList {
pub media_queries: Vec<MediaQuery>,
}
Expand description
A type that encapsulates a media query list.
Fields§
§media_queries: Vec<MediaQuery>
The list of media queries.
Implementations§
source§impl MediaList
impl MediaList
sourcepub fn parse(context: &ParserContext<'_>, input: &mut Parser<'_, '_>) -> Self
pub fn parse(context: &ParserContext<'_>, input: &mut Parser<'_, '_>) -> Self
Parse a media query list from CSS.
Always returns a media query list. If any invalid media query is found, the media query list is only filled with the equivalent of “not all”, see:
sourcepub fn evaluate(&self, device: &Device, quirks_mode: QuirksMode) -> bool
pub fn evaluate(&self, device: &Device, quirks_mode: QuirksMode) -> bool
Evaluate a whole MediaList
against Device
.
sourcepub fn is_viewport_dependent(&self) -> bool
pub fn is_viewport_dependent(&self) -> bool
Whether this MediaList
depends on the viewport size.
sourcepub fn append_medium(
&mut self,
context: &ParserContext<'_>,
new_medium: &str,
) -> bool
pub fn append_medium( &mut self, context: &ParserContext<'_>, new_medium: &str, ) -> bool
Append a new media query item to the media list. https://drafts.csswg.org/cssom/#dom-medialist-appendmedium
Returns true if added, false if fail to parse the medium string.
sourcepub fn delete_medium(
&mut self,
context: &ParserContext<'_>,
old_medium: &str,
) -> bool
pub fn delete_medium( &mut self, context: &ParserContext<'_>, old_medium: &str, ) -> bool
Delete a media query from the media list. https://drafts.csswg.org/cssom/#dom-medialist-deletemedium
Returns true if found and deleted, false otherwise.
Trait Implementations§
source§impl MallocSizeOf for MediaList
impl MallocSizeOf for MediaList
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.
Auto Trait Implementations§
impl Freeze for MediaList
impl RefUnwindSafe for MediaList
impl Send for MediaList
impl Sync for MediaList
impl Unpin for MediaList
impl UnwindSafe for MediaList
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