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,
custom: &mut CustomMediaEvaluator<'_>,
) -> bool
pub fn evaluate( &self, device: &Device, quirks_mode: QuirksMode, custom: &mut CustomMediaEvaluator<'_>, ) -> bool
Evaluate a whole MediaList against Device.
Sourcepub fn matches(
&self,
context: &Context<'_>,
custom: &mut CustomMediaEvaluator<'_>,
) -> KleeneValue
pub fn matches( &self, context: &Context<'_>, custom: &mut CustomMediaEvaluator<'_>, ) -> KleeneValue
Evaluate the current MediaList with a pre-existing context and custom-media evaluator.
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
Source§impl ToCss for MediaList
impl ToCss for MediaList
Source§fn to_css<W>(&self, dest: &mut CssWriter<'_, W>) -> Resultwhere
W: Write,
fn to_css<W>(&self, dest: &mut CssWriter<'_, W>) -> Resultwhere
W: Write,
self in CSS syntax, writing to dest.Source§fn to_css_string(&self) -> String
fn to_css_string(&self) -> String
self in CSS syntax and return a string. Read moreSource§fn to_css_cssstring(&self) -> String
fn to_css_cssstring(&self) -> String
self in CSS syntax and return a CssString. Read moreAuto 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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