struct UnbreakableSegmentUnderConstruction {
inline_size: Au,
max_block_size: LineBlockSizes,
line_items: Vec<LineItem>,
inline_box_hierarchy_depth: Option<usize>,
has_content: bool,
trailing_whitespace_size: Au,
}
Expand description
The current unbreakable segment under construction for an inline formatting context. Items accumulate here until we reach a soft line break opportunity during processing of inline content or we reach the end of the formatting context.
Fields§
§inline_size: Au
The size of this unbreakable segment in both dimension.
max_block_size: LineBlockSizes
The maximum block size that this segment has. This uses LineBlockSizes
instead of a
simple value, because the final block size depends on vertical alignment.
line_items: Vec<LineItem>
The LineItems for the segment under construction
inline_box_hierarchy_depth: Option<usize>
The depth in the inline box hierarchy at the start of this segment. This is used to prefix this segment when it is pushed to a new line.
has_content: bool
Whether any active linebox has added a glyph or atomic element to this line segment, which indicates that the next run that exceeds the line length can cause a line break.
trailing_whitespace_size: Au
The inline size of any trailing whitespace in this segment.
Implementations§
source§impl UnbreakableSegmentUnderConstruction
impl UnbreakableSegmentUnderConstruction
fn new() -> Self
sourcefn push_line_item(
&mut self,
line_item: LineItem,
inline_box_hierarchy_depth: usize,
)
fn push_line_item( &mut self, line_item: LineItem, inline_box_hierarchy_depth: usize, )
Push a single line item to this segment. In addition, record the inline box
hierarchy depth if this is the first segment. The hierarchy depth is used to
duplicate the necessary StartInlineBox
tokens if this segment is ultimately
placed on a new empty line.
sourcefn trim_leading_whitespace(&mut self)
fn trim_leading_whitespace(&mut self)
Trim whitespace from the beginning of this UnbreakbleSegmentUnderConstruction.
From https://www.w3.org/TR/css-text-3/#white-space-phase-2:
Then, the entire block is rendered. Inlines are laid out, taking bidi reordering into account, and wrapping as specified by the text-wrap property. As each line is laid out,
- A sequence of collapsible spaces at the beginning of a line is removed.
This prevents whitespace from being added to the beginning of a line.
Auto Trait Implementations§
impl Freeze for UnbreakableSegmentUnderConstruction
impl !RefUnwindSafe for UnbreakableSegmentUnderConstruction
impl Send for UnbreakableSegmentUnderConstruction
impl Sync for UnbreakableSegmentUnderConstruction
impl Unpin for UnbreakableSegmentUnderConstruction
impl !UnwindSafe for UnbreakableSegmentUnderConstruction
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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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