Struct layout_2020::flow::inline::LineUnderConstruction
source · struct LineUnderConstruction {
start_position: LogicalVec2<Au>,
inline_position: Au,
max_block_size: LineBlockSizes,
has_content: bool,
has_floats_waiting_to_be_placed: bool,
placement_among_floats: OnceCell<LogicalRect<Au>>,
line_items: Vec<LineItem>,
}
Expand description
Information about the current line under construction for a particular
InlineFormattingContextLayout
. This tracks position and size information while
LineItem
s are collected and is used as input when those LineItem
s are
converted into Fragment
s during the final phase of line layout. Note that this
does not store the LineItem
s themselves, as they are stored as part of the
nesting state in the InlineFormattingContextLayout
.
Fields§
§start_position: LogicalVec2<Au>
The position where this line will start once it is laid out. This includes any
offset from text-indent
.
inline_position: Au
The current inline position in the line being laid out into LineItem
s in this
InlineFormattingContext
independent of the depth in the nesting level.
max_block_size: LineBlockSizes
The maximum block size of all boxes that ended and are in progress in this line.
This uses LineBlockSizes
instead of a simple value, because the final block size
depends on vertical alignment.
has_content: bool
Whether any active linebox has added a glyph or atomic element to this line, which indicates that the next run that exceeds the line length can cause a line break.
has_floats_waiting_to_be_placed: bool
Whether or not there are floats that did not fit on the current line. Before
the LineItem
s of this line are laid out, these floats will need to be
placed directly below this line, but still as children of this line’s Fragments.
placement_among_floats: OnceCell<LogicalRect<Au>>
A rectangular area (relative to the containing block / inline formatting
context boundaries) where we can fit the line box without overlapping floats.
Note that when this is not empty, its start corner takes precedence over
LineUnderConstruction::start_position
.
line_items: Vec<LineItem>
The LineItems for the current line under construction that have already been committed to this line.
Implementations§
source§impl LineUnderConstruction
impl LineUnderConstruction
fn new(start_position: LogicalVec2<Au>) -> Self
fn line_block_start_considering_placement_among_floats(&self) -> Au
fn replace_placement_among_floats(&mut self, new_placement: LogicalRect<Au>)
sourcefn trim_trailing_whitespace(&mut self) -> Au
fn trim_trailing_whitespace(&mut self) -> Au
Trim the trailing whitespace in this line and return the width of the whitespace trimmed.
sourcefn count_justification_opportunities(&self) -> usize
fn count_justification_opportunities(&self) -> usize
Count the number of justification opportunities in this line.
Auto Trait Implementations§
impl !Freeze for LineUnderConstruction
impl !RefUnwindSafe for LineUnderConstruction
impl Send for LineUnderConstruction
impl !Sync for LineUnderConstruction
impl Unpin for LineUnderConstruction
impl !UnwindSafe for LineUnderConstruction
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