Skip to main content

StyleTree

Struct StyleTree 

Source
pub struct StyleTree { /* private fields */ }
Expand description

The compiled styling of one book.

Implementations§

Source§

impl StyleTree

Source

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.

Source

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.

Source

pub fn paragraph(&self, id: NodeId) -> ParagraphStyle

Everything line layout needs about one node.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn after(&self, id: NodeId) -> Option<&ComputedStyle>

The same for ::after.

Source

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.

Source

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.

Source

pub fn refers(&self) -> bool

Whether any generated text names another element, for its page or for its text.

Source

pub fn root(&self) -> &ComputedStyle

The style of the book itself: the root of inheritance.

Source

pub fn styles(&self) -> &[ComputedStyle]

The distinct computed styles, in the order nodes index them.

Source

pub fn nodes(&self) -> &[NodeStyle]

Every element, in document order.

Source

pub fn warnings(&self) -> &[Warning]

What compilation had to complain about.

Source

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.

Source

pub fn default_page(&self) -> &PageStyle

The default page: an unnamed body recto. The measure every paragraph breaks to comes from here.

Source

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 Clone for StyleTree

Source§

fn clone(&self) -> StyleTree

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StyleTree

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl InlineStyles for StyleTree

Source§

fn style(&self, id: NodeId, block: &ParagraphStyle) -> ParagraphStyle

The style of id, given the style of the block it sits in.
Source§

fn inline_box(&self, id: NodeId) -> Option<InlineBox>

The box the inline element id paints around its runs, where it paints one. Nothing, for a caller with no tree to ask.
Source§

fn generated(&self, _inline: &Inline) -> Generated

The text the sheet generates around one inline element. Nothing, for a caller with no sheet to ask.
Source§

fn call(&self, _note: &Inline) -> Option<(String, ParagraphStyle)>

The reference of one note, in the style it is set in: the note’s number as the cascade spells it. Nothing, for a caller with no book to number the notes of.
Source§

impl Serialize for StyleTree

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> Finish for T

§

fn finish(self)

Does nothing but move self, equivalent to drop.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<U, T> ToOwnedObj<U> for T
where U: FromObjRef<T>,

§

fn to_owned_obj(&self, data: FontData<'_>) -> U

Convert this type into T, using the provided data to resolve any offsets.
§

impl<U, T> ToOwnedTable<U> for T
where U: FromTableRef<T>,

§

fn to_owned_table(&self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.