pub struct Styler { /* private fields */ }Expand description
Collects stylesheets and styles documents with them.
Implementations§
Source§impl Styler
impl Styler
Sourcepub fn new(env: Environment) -> Styler
pub fn new(env: Environment) -> Styler
A styler with the HTML user agent stylesheet, style="" counted.
Sourcepub fn bare(env: Environment) -> Styler
pub fn bare(env: Environment) -> Styler
A styler with no stylesheet at all, not even the user agent’s.
pub fn environment(&self) -> &Environment
Sourcepub fn add_with_media(
&mut self,
css: &str,
origin: Origin,
media: &str,
) -> &mut Styler
pub fn add_with_media( &mut self, css: &str, origin: Origin, media: &str, ) -> &mut Styler
Adds a stylesheet that applies only where media matches, as a
<style media> or <link media> does.
Sourcepub fn fetch(
self,
fetch: impl Fn(&str) -> Option<String> + Send + Sync + 'static,
) -> Styler
pub fn fetch( self, fetch: impl Fn(&str) -> Option<String> + Send + Sync + 'static, ) -> Styler
Fetches @imported stylesheets with fetch, given each URL as
written; without it, @import is ignored.
Sourcepub fn container_sizes(
self,
size: impl Fn(NodeId, &Computed) -> Option<(f64, f64)> + Send + Sync + 'static,
) -> Styler
pub fn container_sizes( self, size: impl Fn(NodeId, &Computed) -> Option<(f64, f64)> + Send + Sync + 'static, ) -> Styler
Gives each container’s size, for @container and the cq* units:
size is asked for an element whose container-type makes it a
container, with its computed values, and gives its width and height
in CSS pixels. A query on a container with no size given is false,
and cq* units look past it to the next container out, or the
viewport.
Sourcepub fn with_document_styles(self, doc: &Document) -> Styler
pub fn with_document_styles(self, doc: &Document) -> Styler
Adds the document’s own <style> elements, with their media, as
author stylesheets.
Sourcepub fn style_attributes(self, on: bool) -> Styler
pub fn style_attributes(self, on: bool) -> Styler
Whether style="" attributes count; they do unless this says not.