pub(super) struct InlineFormattingContextLayout<'layout_data> {
Show 19 fields positioning_context: &'layout_data mut PositioningContext, containing_block: &'layout_data ContainingBlock<'layout_data>, sequential_layout_state: Option<&'layout_data mut SequentialLayoutState>, layout_context: &'layout_data LayoutContext<'layout_data>, ifc: &'layout_data InlineFormattingContext, root_nesting_level: InlineContainerState, inline_box_state_stack: Vec<Rc<InlineBoxContainerState>>, inline_box_states: Vec<Rc<InlineBoxContainerState>>, fragments: Vec<Fragment>, current_line: LineUnderConstruction, current_line_segment: UnbreakableSegmentUnderConstruction, linebreak_before_new_content: bool, deferred_br_clear: Clear, pub have_deferred_soft_wrap_opportunity: bool, had_inflow_content: bool, depends_on_block_constraints: bool, white_space_collapse: T, text_wrap_mode: T, baselines: Baselines,
}

Fields§

§positioning_context: &'layout_data mut PositioningContext§containing_block: &'layout_data ContainingBlock<'layout_data>§sequential_layout_state: Option<&'layout_data mut SequentialLayoutState>§layout_context: &'layout_data LayoutContext<'layout_data>§ifc: &'layout_data InlineFormattingContext

The InlineFormattingContext that we are laying out.

§root_nesting_level: InlineContainerState

The InlineContainerState for the container formed by the root of the InlineFormattingContext. This is effectively the “root inline box” described by https://drafts.csswg.org/css-inline/#model:

The block container also generates a root inline box, which is an anonymous inline box that holds all of its inline-level contents. (Thus, all text in an inline formatting context is directly contained by an inline box, whether the root inline box or one of its descendants.) The root inline box inherits from its parent block container, but is otherwise unstyleable.

§inline_box_state_stack: Vec<Rc<InlineBoxContainerState>>

A stack of InlineBoxContainerState that is used to produce LineItems either when we reach the end of an inline box or when we reach the end of a line. Only at the end of the inline box is the state popped from the stack.

§inline_box_states: Vec<Rc<InlineBoxContainerState>>

A collection of InlineBoxContainerState of all the inlines that are present in this inline formatting context. We keep this as well as the stack, so that we can access them during line layout, which may happen after relevant InlineBoxContainerStates have been popped of the the stack.

§fragments: Vec<Fragment>

A vector of fragment that are laid out. This includes one Fragment::Positioning per line that is currently laid out plus fragments for all floats, which are currently laid out at the top-level of each InlineFormattingContext.

§current_line: LineUnderConstruction

Information about the line currently being laid out into LineItems.

§current_line_segment: UnbreakableSegmentUnderConstruction

Information about the unbreakable line segment currently being laid out into LineItems.

§linebreak_before_new_content: bool

After a forced line break (for instance from a <br> element) we wait to actually break the line until seeing more content. This allows ongoing inline boxes to finish, since in the case where they have no more content they should not be on the next line.

For instance:

   <span style="border-right: 30px solid blue;">
        first line<br>
   </span>
   second line

In this case, the <span> should not extend to the second line. If we linebreak as soon as we encounter the <br> the <span>’s ending inline borders would be placed on the second line, because we add those borders in InlineFormattingContextLayout::finish_inline_box().

§deferred_br_clear: Clear

When a <br> element has clear, this needs to be applied after the linebreak, which will be processed after the <br> element is processed. This member stores any deferred clear to apply after a linebreak.

§have_deferred_soft_wrap_opportunity: bool

Whether or not a soft wrap opportunity is queued. Soft wrap opportunities are queued after replaced content and they are processed when the next text content is encountered.

§had_inflow_content: bool

Whether or not this InlineFormattingContext has processed any in flow content at all.

§depends_on_block_constraints: bool

Whether or not the layout of this InlineFormattingContext depends on the block size of its container for the purposes of flexbox layout.

§white_space_collapse: T

The currently white-space-collapse setting of this line. This is stored on the InlineFormattingContextLayout because when a soft wrap opportunity is defined by the boundary between two characters, the white-space-collapse property of their nearest common ancestor is used.

§text_wrap_mode: T

The currently text-wrap-mode setting of this line. This is stored on the InlineFormattingContextLayout because when a soft wrap opportunity is defined by the boundary between two characters, the text-wrap-mode property of their nearest common ancestor is used.

§baselines: Baselines

The offset of the first and last baselines in the inline formatting context that we are laying out. This is used to propagate baselines to the ancestors of display: inline-block elements and table content.

Implementations§

source§

impl<'layout_dta> InlineFormattingContextLayout<'layout_dta>

source

fn current_inline_container_state(&self) -> &InlineContainerState

source

fn current_inline_box_identifier(&self) -> Option<InlineBoxIdentifier>

source

fn current_line_max_block_size_including_nested_containers( &self, ) -> LineBlockSizes

source

fn propagate_current_nesting_level_white_space_style(&mut self)

source

fn processing_br_element(&self) -> bool

source

fn start_inline_box(&mut self, inline_box: &InlineBox)

Start laying out a particular InlineBox into line items. This will push a new InlineBoxContainerState onto Self::inline_box_state_stack.

source

fn finish_inline_box(&mut self)

Finish laying out a particular InlineBox into line items. This will pop its state off of Self::inline_box_state_stack.

source

fn finish_last_line(&mut self)

source

fn finish_current_line_and_reset( &mut self, last_line_or_forced_line_break: bool, )

Finish layout of all inline boxes for the current line. This will gather all LineItems and turn them into Fragments, then reset the InlineFormattingContextLayout preparing it for laying out a new line.

source

fn calculate_current_line_inline_start_and_justification_adjustment( &self, whitespace_trimmed: Au, last_line_or_forced_line_break: bool, ) -> (Au, Au)

Given the amount of whitespace trimmed from the line and taking into consideration the text-align property, calculate where the line under construction starts in the inline axis as well as the adjustment needed for every justification opportunity to account for text-align: justify.

source

fn place_float_fragment(&mut self, fragment: &mut BoxFragment)

source

fn place_float_line_item_for_commit_to_line( &mut self, float_item: &mut FloatLineItem, line_inline_size_without_trailing_whitespace: Au, )

Place a FloatLineItem. This is done when an unbreakable segment is committed to the current line. Placement of FloatLineItems might need to be deferred until the line is complete in the case that floats stop fitting on the current line.

When placing floats we do not want to take into account any trailing whitespace on the line, because that whitespace will be trimmed in the case that the line is broken. Thus this function takes as an argument the new size (without whitespace) of the line that these floats are joining.

source

fn place_line_among_floats( &self, potential_line_size: &LogicalVec2<Au>, ) -> LogicalRect<Au>

Given a new potential line size for the current line, create a “placement” for that line. This tells us whether or not the new potential line will fit in the current block position or need to be moved. In addition, the placement rect determines the inline start and end of the line if it’s used as the final placement among floats.

source

fn new_potential_line_size_causes_line_break( &mut self, potential_line_size: &LogicalVec2<Au>, ) -> bool

Returns true if a new potential line size for the current line would require a line break. This takes into account floats and will also update the “placement among floats” for this line if the potential line size would not cause a line break. Thus, calling this method has side effects and should only be done while in the process of laying out line content that is always going to be committed to this line or the next.

source

pub(super) fn defer_forced_line_break(&mut self)

source

pub(super) fn possibly_flush_deferred_forced_line_break(&mut self)

source

fn push_line_item_to_unbreakable_segment(&mut self, line_item: LineItem)

source

pub(super) fn push_glyph_store_to_unbreakable_segment( &mut self, glyph_store: Arc<GlyphStore>, text_run: &TextRun, font_index: usize, bidi_level: Level, )

source

fn update_unbreakable_segment_for_new_content( &mut self, block_sizes_of_content: &LineBlockSizes, inline_size: Au, flags: SegmentContentFlags, )

source

fn process_line_break(&mut self, forced_line_break: bool)

source

pub(super) fn unbreakable_segment_fits_on_line(&mut self) -> bool

source

pub(super) fn process_soft_wrap_opportunity(&mut self)

Process a soft wrap opportunity. This will either commit the current unbreakble segment to the current line, if it fits within the containing block and float placement boundaries, or do a line break and then commit the segment.

source

fn commit_current_segment_to_line(&mut self)

Commit the current unbrekable segment to the current line. In addition, this will place all floats in the unbreakable segment and expand the line dimensions.

Auto Trait Implementations§

§

impl<'layout_data> !Freeze for InlineFormattingContextLayout<'layout_data>

§

impl<'layout_data> !RefUnwindSafe for InlineFormattingContextLayout<'layout_data>

§

impl<'layout_data> !Send for InlineFormattingContextLayout<'layout_data>

§

impl<'layout_data> !Sync for InlineFormattingContextLayout<'layout_data>

§

impl<'layout_data> Unpin for InlineFormattingContextLayout<'layout_data>

§

impl<'layout_data> !UnwindSafe for InlineFormattingContextLayout<'layout_data>

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

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

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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>

source§

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

source§

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<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T