Struct layout_2020::flow::inline::construct::InlineFormattingContextBuilder
source · pub(crate) struct InlineFormattingContextBuilder {
pub text_segments: Vec<String>,
current_text_offset: usize,
last_inline_box_ended_with_collapsible_white_space: bool,
on_word_boundary: bool,
pub contains_floats: bool,
pub inline_items: Vec<ArcRefCell<InlineItem>>,
pub inline_boxes: InlineBoxes,
inline_box_stack: Vec<InlineBoxIdentifier>,
pub has_uncollapsible_text_content: bool,
}
Fields§
§text_segments: Vec<String>
The collection of text strings that make up this InlineFormattingContext
under
construction.
current_text_offset: usize
The current offset in the final text string of this InlineFormattingContext
,
used to properly set the text range of new InlineItem::TextRun
s.
last_inline_box_ended_with_collapsible_white_space: bool
Whether the last processed node ended with whitespace. This is used to implement rule 4 of https://www.w3.org/TR/css-text-3/#collapse:
Any collapsible space immediately following another collapsible space—even one outside the boundary of the inline containing that space, provided both spaces are within the same inline formatting context—is collapsed to have zero advance width. (It is invisible, but retains its soft wrap opportunity, if any.)
on_word_boundary: bool
Whether or not the current state of the inline formatting context is on a word boundary
for the purposes of text-transform: capitalize
.
contains_floats: bool
Whether or not this inline formatting context will contain floats.
inline_items: Vec<ArcRefCell<InlineItem>>
The current list of InlineItem
s in this InlineFormattingContext
under
construction. This is stored in a flat list to make it easy to access the last
item.
inline_boxes: InlineBoxes
The current InlineBox
tree of this InlineFormattingContext
under construction.
inline_box_stack: Vec<InlineBoxIdentifier>
The ongoing stack of inline boxes stack of the builder.
Contains all the currently ongoing inline boxes we entered so far.
The traversal is at all times as deep in the tree as this stack is,
which is why the code doesn’t need to keep track of the actual
container root (see handle_inline_level_element
).
When an inline box ends, it’s removed from this stack.
has_uncollapsible_text_content: bool
Whether or not the inline formatting context under construction has any uncollapsible text content.
Implementations§
source§impl InlineFormattingContextBuilder
impl InlineFormattingContextBuilder
pub(crate) fn new() -> Self
pub(crate) fn currently_processing_inline_box(&self) -> bool
fn push_control_character_string(&mut self, string_to_push: &str)
sourcepub(crate) fn is_empty(&self) -> bool
pub(crate) fn is_empty(&self) -> bool
Return true if this InlineFormattingContextBuilder
is empty for the purposes of ignoring
during box tree construction. An IFC is empty if it only contains TextRuns with
completely collapsible whitespace. When that happens it can be ignored completely.
pub(crate) fn push_atomic( &mut self, independent_formatting_context: IndependentFormattingContext, ) -> ArcRefCell<InlineItem>
pub(crate) fn push_absolutely_positioned_box( &mut self, absolutely_positioned_box: AbsolutelyPositionedBox, ) -> ArcRefCell<InlineItem>
pub(crate) fn push_float_box( &mut self, float_box: FloatBox, ) -> ArcRefCell<InlineItem>
pub(crate) fn start_inline_box( &mut self, inline_box: InlineBox, ) -> ArcRefCell<InlineItem>
pub(crate) fn end_inline_box(&mut self) -> ArcRefCell<InlineBox>
fn end_inline_box_internal(&mut self) -> InlineBoxIdentifier
pub(crate) fn push_text<'dom, Node: NodeExt<'dom>>( &mut self, text: Cow<'dom, str>, info: &NodeAndStyleInfo<Node>, )
pub(crate) fn split_around_block_and_finish( &mut self, layout_context: &LayoutContext<'_>, text_decoration_line: TextDecorationLine, has_first_formatted_line: bool, default_bidi_level: Level, ) -> Option<InlineFormattingContext>
sourcepub(crate) fn finish(
&mut self,
layout_context: &LayoutContext<'_>,
text_decoration_line: TextDecorationLine,
has_first_formatted_line: bool,
is_single_line_text_input: bool,
default_bidi_level: Level,
) -> Option<InlineFormattingContext>
pub(crate) fn finish( &mut self, layout_context: &LayoutContext<'_>, text_decoration_line: TextDecorationLine, has_first_formatted_line: bool, is_single_line_text_input: bool, default_bidi_level: Level, ) -> Option<InlineFormattingContext>
Finish the current inline formatting context, returning None
if the context was empty.
Trait Implementations§
source§impl Default for InlineFormattingContextBuilder
impl Default for InlineFormattingContextBuilder
source§fn default() -> InlineFormattingContextBuilder
fn default() -> InlineFormattingContextBuilder
Auto Trait Implementations§
impl Freeze for InlineFormattingContextBuilder
impl !RefUnwindSafe for InlineFormattingContextBuilder
impl Send for InlineFormattingContextBuilder
impl Sync for InlineFormattingContextBuilder
impl Unpin for InlineFormattingContextBuilder
impl !UnwindSafe for InlineFormattingContextBuilder
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 moresource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.