Skip to main content

LineUnderConstruction

Struct 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>,
    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: Au

The 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: 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 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: bool

Whether 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: Au

The inline size of any trailing hangable white space in this line.

§trailing_removable_white_space: Au

The inline size of any trailing removable white space in this line.

Implementations§

Source§

impl LineUnderConstruction

Source

fn new(start_position: LogicalVec2<Au>) -> Self

Source

fn replace_placement_among_floats(&mut self, new_placement: LogicalRect<Au>)

Source

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.
Source

fn count_justification_opportunities(&self) -> usize

Count the number of justification opportunities in this line.

Source

fn is_phantom(&self) -> bool

Source

fn is_phantom_inner(has_content: bool, line_items: &[LineItem]) -> bool

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> MaybeBoxed<Box<T>> for T

Source§

fn maybe_boxed(self) -> Box<T>

Convert
Source§

impl<T> MaybeBoxed<T> for T

Source§

fn maybe_boxed(self) -> T

Convert
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,