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>,
for_block_level: bool,
caret_placeholder: Option<CaretPlaceholder>,
cloneable_inline_box_pbm_size: LogicalSides1D<Au>,
trailing_hangable_white_space: Au,
trailing_removable_white_space: Au,
}Expand description
Information about the current line under construction for a particular
InlineFormattingContextLayout. This tracks position and size information while
LineItems are collected and is used as input when those LineItems are
converted into Fragments during the final phase of line layout. Note that this
does not store the LineItems 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: AuThe current inline position in the line being laid out into LineItems in this
InlineFormattingContext independent of the depth in the nesting level.
max_block_size: LineBlockSizesThe 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: boolWhether 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: boolWhether or not there are floats that did not fit on the current line. Before
the LineItems 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.
for_block_level: boolWhether the current line is for a block-level box.
caret_placeholder: Option<CaretPlaceholder>If this line is empty and contains a selection, this field will be used to create
an empty [TextFragment] for holding a text caret.
cloneable_inline_box_pbm_size: LogicalSides1D<Au>The amount of space that will be taken up by all inline padding, borders and
margins of all inline boxes with box-decoration-break: clone that we are
currently inside of.
trailing_hangable_white_space: AuThe inline size of any trailing hangable white space in this line.
trailing_removable_white_space: AuThe inline size of any trailing removable white space in this line.
Implementations§
Source§impl LineUnderConstruction
impl LineUnderConstruction
fn new(start_position: LogicalVec2<Au>) -> Self
fn replace_placement_among_floats(&mut self, new_placement: LogicalRect<Au>)
Sourcefn trim_trailing_white_space_and_calculate_hanging(
&mut self,
available_inline_size: Au,
last_line_or_forced_line_break: bool,
) -> Au
fn trim_trailing_white_space_and_calculate_hanging( &mut self, available_inline_size: Au, last_line_or_forced_line_break: bool, ) -> Au
Trim the trailing removable white space in this line, returning the amount of white space that hangs.
This is https://www.w3.org/TR/css-text-3/#white-space-phase-2 steps 3 and 4.
- Step 3. A sequence of collapsible spaces at the end of a line is removed, as well as any trailing U+1680 OGHAM SPACE MARK whose white-space property is normal, nowrap, or pre-line.
- Step 4. If there remains any sequence of white space, other space separators, and/or preserved tabs at the end of a line (after bidi reordering [CSS-WRITING-MODES-4]):
- If white-space is set to normal, nowrap, or pre-line, the UA must hang this sequence (unconditionally).
- If white-space is set to pre-wrap, the UA must (unconditionally) hang this sequence, unless the sequence is followed by a forced line break, in which case it must conditionally hang the sequence instead. It may also visually collapse the character advance widths of any that would otherwise overflow.
- If white-space is set to break-spaces, spaces, tabs, and other space separators are treated the same as other visible characters: they cannot hang nor have their advance width collapsed.
Sourcefn count_justification_opportunities(&self) -> usize
fn count_justification_opportunities(&self) -> usize
Count the number of justification opportunities in this line.
Sourcefn is_phantom(&self) -> bool
fn is_phantom(&self) -> bool
Whether this is a phantom line box. https://drafts.csswg.org/css-inline-3/#invisible-line-boxes
fn is_phantom_inner(has_content: bool, line_items: &[LineItem]) -> bool
Sourcefn tentative_hanging_and_removable_white_space_advance(&self) -> Au
fn tentative_hanging_and_removable_white_space_advance(&self) -> Au
The advance of the whitespace at the end of this line that would either hang or be trimmed if it was at the end of a line.
Note: This is only valid during line construction, because it doesn’t take into account conditional hanging.
Auto Trait Implementations§
impl !Freeze for LineUnderConstruction
impl !RefUnwindSafe for LineUnderConstruction
impl !Send for LineUnderConstruction
impl !Sync for LineUnderConstruction
impl Unpin for LineUnderConstruction
impl UnsafeUnpin 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