pub struct DisplayList {
pub items: Vec<DisplayListItem>,
pub node_mapping: Vec<Option<NodeId>>,
pub forced_page_breaks: Vec<f32>,
pub fixed_position_item_ranges: Vec<(usize, usize)>,
}Expand description
The final, renderer-agnostic output of the layout engine.
This is a flat list of drawing and state-management commands, already sorted according to the CSS paint order. A renderer can consume this list directly.
Fields§
§items: Vec<DisplayListItem>§node_mapping: Vec<Option<NodeId>>Optional mapping from item index to the DOM NodeId that generated it. Used for pagination to look up CSS break properties. Not all items have a source node (e.g., synthesized decorations).
forced_page_breaks: Vec<f32>Y-positions where forced page breaks should occur (from break-before/break-after: always). These are absolute Y coordinates in the infinite canvas coordinate system. The slicer will ensure page boundaries align with these positions.
fixed_position_item_ranges: Vec<(usize, usize)>Index ranges (start, end) of display list items that belong to fixed-position elements. In paged media, these items are replicated on every page (CSS Positioned Layout §2.1).
Implementations§
Source§impl DisplayList
impl DisplayList
Sourcepub fn patch_text_glyphs(
&mut self,
node_index: usize,
new_glyphs_by_run: &[Vec<GlyphInstance>],
) -> Option<LogicalRect>
pub fn patch_text_glyphs( &mut self, node_index: usize, new_glyphs_by_run: &[Vec<GlyphInstance>], ) -> Option<LogicalRect>
Patch text glyph data for a specific layout node without rebuilding the entire display list. Returns the damage rect covering all affected text items, or None if no matching items found.
Used for GlyphSwap incremental relayout: glyphs changed but positions are identical, so only the glyph IDs need updating.
Sourcepub fn compute_text_damage_rect(
old_items: &[PositionedItem],
new_items: &[PositionedItem],
container_origin: LogicalPosition,
affected_line: usize,
) -> LogicalRect
pub fn compute_text_damage_rect( old_items: &[PositionedItem], new_items: &[PositionedItem], container_origin: LogicalPosition, affected_line: usize, ) -> LogicalRect
Compute a damage rect from the difference between old and new text layout results, starting from a given line index.
Sourcepub fn to_debug_json(&self) -> String
pub fn to_debug_json(&self) -> String
Generates a JSON representation of the display list for debugging. This includes clip chain analysis showing how clips are stacked.
Trait Implementations§
Source§impl Clone for DisplayList
impl Clone for DisplayList
Source§fn clone(&self) -> DisplayList
fn clone(&self) -> DisplayList
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DisplayList
impl Debug for DisplayList
Source§impl Default for DisplayList
impl Default for DisplayList
Source§fn default() -> DisplayList
fn default() -> DisplayList
Auto Trait Implementations§
impl Freeze for DisplayList
impl !RefUnwindSafe for DisplayList
impl Send for DisplayList
impl Sync for DisplayList
impl Unpin for DisplayList
impl UnsafeUnpin for DisplayList
impl !UnwindSafe for DisplayList
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