pub struct Stylesheets { /* private fields */ }Expand description
Parsed stylesheets: the built-in sheet, then whatever the host added, ready to compile against a book.
Parsing is separate from compiling because a run styles several books from one set of sheets, and separate from font loading because loading is the one step that reaches outside the engine.
Implementations§
Source§impl Stylesheets
impl Stylesheets
Sourcepub fn inspect(
&self,
book: &Book,
tree: &StyleTree,
node: NodeId,
) -> Option<Inspection>
pub fn inspect( &self, book: &Book, tree: &StyleTree, node: NodeId, ) -> Option<Inspection>
What the cascade did for one node of book, whose styling
tree is, compiled from these sheets. A text node answers for
the element that holds it.
The id of a pseudo-element answers for the pseudo-element: the rules that match it and the style it computed to.
None for a node the book does not hold, for a pseudo-element
no rule styles, and for the id the engine writes its own text
under. The boxes are left empty, since only a laid-out book has
them.
Sourcepub fn inspect_margin_box(
&self,
tree: &StyleTree,
query: PageQuery<'_>,
which: MarginBox,
) -> Option<Inspection>
pub fn inspect_margin_box( &self, tree: &StyleTree, query: PageQuery<'_>, which: MarginBox, ) -> Option<Inspection>
What the cascade did for one margin box of a page query
describes, whose master tree resolved from these sheets.
None for a box no rule for that page names. The boxes are left
empty, since only a laid-out book has them.
Source§impl Stylesheets
impl Stylesheets
Sourcepub fn parse(sources: &[Source<'_>]) -> Stylesheets
pub fn parse(sources: &[Source<'_>]) -> Stylesheets
Parses the built-in sheet, then sources in the order given.
Sourcepub fn load_fonts(
&mut self,
registry: &mut FontRegistry,
loader: &dyn FontLoader,
)
pub fn load_fonts( &mut self, registry: &mut FontRegistry, loader: &dyn FontLoader, )
Registers every @font-face the loader resolves, under the
family the sheet gave it rather than the one inside the file:
a stylesheet’s name for a face is the one its selectors use.
Run this before compiling — a face the registry does not have is a face no computed style can resolve to. Running it again replaces what the last run warned about.
Sourcepub fn written(&self) -> Vec<WrittenSheet>
pub fn written(&self) -> Vec<WrittenSheet>
Every sheet as it was written, the built-in sheet first: what a writer reads that hands the CSS to a renderer of its own rather than laying it out.
Only what the parser accepted is here. A rule or a declaration
outside the subset is in Stylesheets::warnings instead.
Sourcepub fn compile(&self, book: &Book, registry: &FontRegistry) -> StyleTree
pub fn compile(&self, book: &Book, registry: &FontRegistry) -> StyleTree
Compiles one book’s styling against the faces in the registry.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Stylesheets
impl RefUnwindSafe for Stylesheets
impl Send for Stylesheets
impl Sync for Stylesheets
impl Unpin for Stylesheets
impl UnsafeUnpin for Stylesheets
impl UnwindSafe for Stylesheets
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
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.