pub struct InlineFormattingContext {
pub items: SmallVec<[InlineItem; 16]>,
}Expand description
The inline formatting context for a block container.
Collects all inline-level content into a flat item list, then delegates to the line breaker for layout.
Fields§
§items: SmallVec<[InlineItem; 16]>Flat list of inline items (text runs, open/close tags, atomics).
SmallVec avoids heap allocation for the common case of ≤16 items.
Implementations§
Source§impl InlineFormattingContext
impl InlineFormattingContext
pub fn new() -> Self
Sourcepub fn add_text(
&mut self,
content: Arc<str>,
style: Arc<ComputedValues>,
measurer: &dyn TextMeasurer,
)
pub fn add_text( &mut self, content: Arc<str>, style: Arc<ComputedValues>, measurer: &dyn TextMeasurer, )
Add a text run, measuring it via the provided TextMeasurer.
Chrome equivalent: InlineBoxState::ComputeTextMetrics().
measure()→ShapeResult(width from glyph advances)font_metrics()→FontMetrics(ascent/descent/lineGap from font)resolve_line_height()→ CSS line-height → pixel valueFontHeight::from_metrics_and_line_height()→ leading split
Sourcepub fn add_atomic(
&mut self,
width: f32,
height: f32,
baseline: f32,
layout_id: u32,
style: Arc<ComputedValues>,
)
pub fn add_atomic( &mut self, width: f32, height: f32, baseline: f32, layout_id: u32, style: Arc<ComputedValues>, )
Add an atomic inline (inline-block, image, etc.).
Sourcepub fn add_open_tag(&mut self, style: Arc<ComputedValues>)
pub fn add_open_tag(&mut self, style: Arc<ComputedValues>)
Add an open tag for an inline element.
Sourcepub fn add_close_tag(&mut self, style: &ComputedValues)
pub fn add_close_tag(&mut self, style: &ComputedValues)
Add a close tag for an inline element.
Trait Implementations§
Source§impl Clone for InlineFormattingContext
impl Clone for InlineFormattingContext
Source§fn clone(&self) -> InlineFormattingContext
fn clone(&self) -> InlineFormattingContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InlineFormattingContext
impl Debug for InlineFormattingContext
Auto Trait Implementations§
impl Freeze for InlineFormattingContext
impl !RefUnwindSafe for InlineFormattingContext
impl Send for InlineFormattingContext
impl Sync for InlineFormattingContext
impl Unpin for InlineFormattingContext
impl UnsafeUnpin for InlineFormattingContext
impl !UnwindSafe for InlineFormattingContext
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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 moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert