pub(crate) struct BlockContainerBuilder<'dom, 'style> {
context: &'style LayoutContext<'style>,
info: &'style NodeAndStyleInfo<'dom>,
block_level_boxes: Vec<BlockLevelJob<'dom>>,
have_already_seen_first_line_for_text_indent: bool,
propagated_data: PropagatedBoxTreeData,
inline_formatting_context_builder: Option<InlineFormattingContextBuilder>,
anonymous_box_info: Option<NodeAndStyleInfo<'dom>>,
anonymous_table_content: Vec<AnonymousTableContent<'dom>>,
display_contents_shared_styles: Vec<SharedInlineStyles>,
}
Expand description
A builder for a block container.
This builder starts from the first child of a given DOM node and does a preorder traversal of all of its inclusive siblings.
Fields§
§context: &'style LayoutContext<'style>
§info: &'style NodeAndStyleInfo<'dom>
This NodeAndStyleInfo contains the root node, the corresponding pseudo content designator, and the block container style.
block_level_boxes: Vec<BlockLevelJob<'dom>>
The list of block-level boxes to be built for the final block container.
Contains all the block-level jobs we found traversing the tree
so far, if this is empty at the end of the traversal and the ongoing
inline formatting context is not empty, the block container establishes
an inline formatting context (see end of build
).
DOM nodes which represent block-level boxes are immediately pushed
to this list with their style without ever being traversed at this
point, instead we just move to their next sibling. If the DOM node
doesn’t have a next sibling, we either reached the end of the container
root or there are ongoing inline-level boxes
(see handle_block_level_element
).
have_already_seen_first_line_for_text_indent: bool
Whether or not this builder has yet produced a block which would be
be considered the first line for the purposes of text-indent
.
propagated_data: PropagatedBoxTreeData
The propagated data to use for BoxTree construction.
inline_formatting_context_builder: Option<InlineFormattingContextBuilder>
The InlineFormattingContextBuilder
if we have encountered any inline items,
otherwise None.
TODO: This can be OnceCell
once OnceCell::get_mut_or_init
is stabilized.
anonymous_box_info: Option<NodeAndStyleInfo<'dom>>
The NodeAndStyleInfo
to use for anonymous block boxes pushed to the list of
block-level boxes, lazily initialized.
anonymous_table_content: Vec<AnonymousTableContent<'dom>>
A collection of content that is being added to an anonymous table. This is composed of any sequence of internal table elements or table captions that are found outside of a table.
Any [InlineFormattingContexts
] created need to know about the ongoing display: contents
ancestors that have been processed. This Vec
allows passing those into new
InlineFormattingContext
s that we create.
Implementations§
Source§impl<'dom, 'style> BlockContainerBuilder<'dom, 'style>
impl<'dom, 'style> BlockContainerBuilder<'dom, 'style>
pub(crate) fn new( context: &'style LayoutContext<'_>, info: &'style NodeAndStyleInfo<'dom>, propagated_data: PropagatedBoxTreeData, ) -> Self
fn currently_processing_inline_box(&self) -> bool
fn ensure_inline_formatting_context_builder( &mut self, ) -> &mut InlineFormattingContextBuilder
fn finish_ongoing_inline_formatting_context( &mut self, ) -> Option<InlineFormattingContext>
pub(crate) fn finish(self) -> BlockContainer
fn finish_anonymous_table_if_needed(&mut self)
Source§impl<'dom> BlockContainerBuilder<'dom, '_>
impl<'dom> BlockContainerBuilder<'dom, '_>
fn handle_list_item_marker_inside( &mut self, marker_info: &NodeAndStyleInfo<'dom>, contents: Vec<PseudoElementContentItem>, )
fn handle_list_item_marker_outside( &mut self, marker_info: &NodeAndStyleInfo<'dom>, contents: Vec<PseudoElementContentItem>, list_item_style: Arc<ComputedValues>, )
fn handle_inline_level_element( &mut self, info: &NodeAndStyleInfo<'dom>, display_inside: DisplayInside, contents: Contents, box_slot: BoxSlot<'dom>, )
fn handle_block_level_element( &mut self, info: &NodeAndStyleInfo<'dom>, display_inside: DisplayInside, contents: Contents, box_slot: BoxSlot<'dom>, )
fn handle_absolutely_positioned_element( &mut self, info: &NodeAndStyleInfo<'dom>, display_inside: DisplayInside, contents: Contents, box_slot: BoxSlot<'dom>, )
fn handle_float_element( &mut self, info: &NodeAndStyleInfo<'dom>, display_inside: DisplayInside, contents: Contents, box_slot: BoxSlot<'dom>, )
fn push_block_level_job_for_inline_formatting_context( &mut self, inline_formatting_context: InlineFormattingContext, )
Trait Implementations§
Source§impl<'dom> TraversalHandler<'dom> for BlockContainerBuilder<'dom, '_>
impl<'dom> TraversalHandler<'dom> for BlockContainerBuilder<'dom, '_>
Source§fn handle_element(
&mut self,
info: &NodeAndStyleInfo<'dom>,
display: DisplayGeneratingBox,
contents: Contents,
box_slot: BoxSlot<'dom>,
)
fn handle_element( &mut self, info: &NodeAndStyleInfo<'dom>, display: DisplayGeneratingBox, contents: Contents, box_slot: BoxSlot<'dom>, )
fn handle_text(&mut self, info: &NodeAndStyleInfo<'dom>, text: Cow<'dom, str>)
Source§fn enter_display_contents(&mut self, styles: SharedInlineStyles)
fn enter_display_contents(&mut self, styles: SharedInlineStyles)
display: contents
element.Source§fn leave_display_contents(&mut self)
fn leave_display_contents(&mut self)
display: contents
element.Auto Trait Implementations§
impl<'dom, 'style> Freeze for BlockContainerBuilder<'dom, 'style>
impl<'dom, 'style> !RefUnwindSafe for BlockContainerBuilder<'dom, 'style>
impl<'dom, 'style> Send for BlockContainerBuilder<'dom, 'style>
impl<'dom, 'style> Sync for BlockContainerBuilder<'dom, 'style>
impl<'dom, 'style> Unpin for BlockContainerBuilder<'dom, 'style>
impl<'dom, 'style> !UnwindSafe for BlockContainerBuilder<'dom, 'style>
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> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
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