pub struct StyleTree { /* private fields */ }Expand description
The compiled styling of one book.
Implementations§
Source§impl StyleTree
impl StyleTree
Sourcepub fn style(&self, id: NodeId) -> &ComputedStyle
pub fn style(&self, id: NodeId) -> &ComputedStyle
The computed style of one content node, or of one pseudo-element. An id the tree does not know — an unassigned one, or a node from another book — gets the root style, which is the book’s own defaults.
Sourcepub fn notes_area(&self) -> NodeId
pub fn notes_area(&self) -> NodeId
The node the footnote area is styled by: the notes element,
which stands for the foot of every page.
Sourcepub fn paragraph(&self, id: NodeId) -> ParagraphStyle
pub fn paragraph(&self, id: NodeId) -> ParagraphStyle
Everything line layout needs about one node.
Sourcepub fn first_letter(&self, id: NodeId) -> Option<&ComputedStyle>
pub fn first_letter(&self, id: NodeId) -> Option<&ComputedStyle>
The style ::first-letter computed for one node, when a rule
named one. This is where a drop cap’s size and face come from.
Sourcepub fn first_line(&self, id: NodeId) -> Option<&ComputedStyle>
pub fn first_line(&self, id: NodeId) -> Option<&ComputedStyle>
The style ::first-line computed for one node, when a rule
named one. Line layout reads it as what the opening line
changes about the paragraph around it.
Sourcepub fn opening_line(&self, id: NodeId) -> Option<FirstLine>
pub fn opening_line(&self, id: NodeId) -> Option<FirstLine>
What ::first-line changes about one node’s own style, which
is what line layout applies to the opening line.
Sourcepub fn before(&self, id: NodeId) -> Option<&ComputedStyle>
pub fn before(&self, id: NodeId) -> Option<&ComputedStyle>
The style ::before computed for one node, when its content
generates anything. On an inline that is text inside the line.
On a block it is a box, the first child of the block.
Sourcepub fn after(&self, id: NodeId) -> Option<&ComputedStyle>
pub fn after(&self, id: NodeId) -> Option<&ComputedStyle>
The same for ::after.
Sourcepub fn pseudo_element(
&self,
element: NodeId,
which: PseudoElement,
) -> Option<NodeId>
pub fn pseudo_element( &self, element: NodeId, which: PseudoElement, ) -> Option<NodeId>
The id of one pseudo-element of element, where a rule styles
it. On a block, ::before and ::after are boxes. On an
inline element, they are text inside the line. The id comes
from the element and the pseudo-element alone, so it is the
same in every layout of the same book and sheets, and no
content node has it. style answers for it.
Sourcepub fn counts_pages(&self) -> bool
pub fn counts_pages(&self) -> bool
Whether any generated text prints the page another element lands on. Such a book is laid out twice: once to find the pages, and once to print them.
Sourcepub fn refers(&self) -> bool
pub fn refers(&self) -> bool
Whether any generated text names another element, for its page or for its text.
Sourcepub fn root(&self) -> &ComputedStyle
pub fn root(&self) -> &ComputedStyle
The style of the book itself: the root of inheritance.
Sourcepub fn styles(&self) -> &[ComputedStyle]
pub fn styles(&self) -> &[ComputedStyle]
The distinct computed styles, in the order nodes index them.
Sourcepub fn page(&self, query: PageQuery<'_>) -> &PageStyle
pub fn page(&self, query: PageQuery<'_>) -> &PageStyle
The page master one page resolves to. A named page with no master of its own falls back to the unnamed one.
Sourcepub fn default_page(&self) -> &PageStyle
pub fn default_page(&self) -> &PageStyle
The default page: an unnamed body recto. The measure every paragraph breaks to comes from here.
Sourcepub fn masters(&self) -> &[PageMaster]
pub fn masters(&self) -> &[PageMaster]
Every master this book can put on a page: one per named page and situation, in a stable order.
Trait Implementations§
Source§impl InlineStyles for StyleTree
impl InlineStyles for StyleTree
Source§fn style(&self, id: NodeId, block: &ParagraphStyle) -> ParagraphStyle
fn style(&self, id: NodeId, block: &ParagraphStyle) -> ParagraphStyle
id, given the style of the block it sits in.Source§fn inline_box(&self, id: NodeId) -> Option<InlineBox>
fn inline_box(&self, id: NodeId) -> Option<InlineBox>
id paints around its runs, where
it paints one. Nothing, for a caller with no tree to ask.Auto Trait Implementations§
impl Freeze for StyleTree
impl RefUnwindSafe for StyleTree
impl Send for StyleTree
impl Sync for StyleTree
impl Unpin for StyleTree
impl UnsafeUnpin for StyleTree
impl UnwindSafe for StyleTree
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,
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.