Trait layout_2013::flow::Flow
source · pub trait Flow: HasBaseFlow + Debug + Sync + Send + 'static {
Show 46 methods
// Required methods
fn class(&self) -> FlowClass;
fn collect_stacking_contexts(
&mut self,
state: &mut StackingContextCollectionState,
);
fn build_display_list(&mut self, state: &mut DisplayListBuildState<'_>);
fn compute_overflow(&self) -> Overflow;
fn iterate_through_fragment_border_boxes(
&self,
iterator: &mut dyn FragmentBorderBoxIterator,
level: i32,
stacking_context_position: &Point2D<Au>,
);
fn mutate_fragments(&mut self, mutator: &mut dyn FnMut(&mut Fragment));
fn update_late_computed_inline_position_if_necessary(
&mut self,
inline_position: Au,
);
fn update_late_computed_block_position_if_necessary(
&mut self,
block_position: Au,
);
fn generated_containing_block_size(&self, _: OpaqueFlow) -> LogicalSize<Au>;
fn repair_style(&mut self, new_style: &Arc<ComputedValues>);
// Provided methods
fn as_block(&self) -> &BlockFlow { ... }
fn as_mut_block(&mut self) -> &mut BlockFlow { ... }
fn as_flex(&self) -> &FlexFlow { ... }
fn as_inline(&self) -> &InlineFlow { ... }
fn as_mut_inline(&mut self) -> &mut InlineFlow { ... }
fn as_table_wrapper(&self) -> &TableWrapperFlow { ... }
fn as_mut_table(&mut self) -> &mut TableFlow { ... }
fn as_table(&self) -> &TableFlow { ... }
fn as_mut_table_colgroup(&mut self) -> &mut TableColGroupFlow { ... }
fn as_table_colgroup(&self) -> &TableColGroupFlow { ... }
fn as_mut_table_rowgroup(&mut self) -> &mut TableRowGroupFlow { ... }
fn as_table_rowgroup(&self) -> &TableRowGroupFlow { ... }
fn as_mut_table_row(&mut self) -> &mut TableRowFlow { ... }
fn as_table_row(&self) -> &TableRowFlow { ... }
fn as_mut_table_cell(&mut self) -> &mut TableCellFlow { ... }
fn as_table_cell(&self) -> &TableCellFlow { ... }
fn bubble_inline_sizes(&mut self) { ... }
fn assign_inline_sizes(&mut self, _ctx: &LayoutContext<'_>) { ... }
fn assign_block_size(&mut self, _ctx: &LayoutContext<'_>) { ... }
fn fragment(
&mut self,
layout_context: &LayoutContext<'_>,
_fragmentation_context: Option<FragmentationContext>,
) -> Option<Arc<dyn Flow>> { ... }
fn place_float_if_applicable(&mut self) { ... }
fn assign_block_size_for_inorder_child_if_necessary(
&mut self,
layout_context: &LayoutContext<'_>,
parent_thread_id: u8,
_content_box: LogicalRect<Au>,
) -> bool { ... }
fn has_non_invertible_transform_or_zero_scale(&self) -> bool { ... }
fn get_overflow_in_parent_coordinates(&self) -> Overflow { ... }
fn store_overflow(&mut self, _: &LayoutContext<'_>) { ... }
fn compute_stacking_relative_position(&mut self, _: &LayoutContext<'_>) { ... }
fn mark_as_root(&mut self) { ... }
fn is_root(&self) -> bool { ... }
fn positioning(&self) -> Position { ... }
fn is_fixed(&self) -> bool { ... }
fn contains_positioned_fragments(&self) -> bool { ... }
fn contains_relatively_positioned_fragments(&self) -> bool { ... }
fn is_absolute_containing_block(&self) -> bool { ... }
fn contains_roots_of_absolute_flow_tree(&self) -> bool { ... }
fn print_extra_flow_children(&self, _: &mut PrintTree) { ... }
fn clipping_and_scrolling(&self) -> ClippingAndScrolling { ... }
}
Expand description
Virtual methods that make up a float context.
Note that virtual methods have a cost; we should not overuse them in Servo. Consider adding
methods to ImmutableFlowUtils
or MutableFlowUtils
before adding more methods here.
Required Methods§
fn collect_stacking_contexts( &mut self, state: &mut StackingContextCollectionState, )
sourcefn build_display_list(&mut self, state: &mut DisplayListBuildState<'_>)
fn build_display_list(&mut self, state: &mut DisplayListBuildState<'_>)
Phase 5 of reflow: builds display lists.
sourcefn compute_overflow(&self) -> Overflow
fn compute_overflow(&self) -> Overflow
Returns the union of all overflow rects of all of this flow’s fragments.
sourcefn iterate_through_fragment_border_boxes(
&self,
iterator: &mut dyn FragmentBorderBoxIterator,
level: i32,
stacking_context_position: &Point2D<Au>,
)
fn iterate_through_fragment_border_boxes( &self, iterator: &mut dyn FragmentBorderBoxIterator, level: i32, stacking_context_position: &Point2D<Au>, )
Iterates through border boxes of all of this flow’s fragments. Level provides a zero based index indicating the current depth of the flow tree during fragment iteration.
sourcefn mutate_fragments(&mut self, mutator: &mut dyn FnMut(&mut Fragment))
fn mutate_fragments(&mut self, mutator: &mut dyn FnMut(&mut Fragment))
Mutably iterates through fragments in this flow.
sourcefn update_late_computed_inline_position_if_necessary(
&mut self,
inline_position: Au,
)
fn update_late_computed_inline_position_if_necessary( &mut self, inline_position: Au, )
Updates the inline position of a child flow during the assign-height traversal. At present, this is only used for absolutely-positioned inline-blocks.
sourcefn update_late_computed_block_position_if_necessary(
&mut self,
block_position: Au,
)
fn update_late_computed_block_position_if_necessary( &mut self, block_position: Au, )
Updates the block position of a child flow during the assign-height traversal. At present, this is only used for absolutely-positioned inline-blocks.
sourcefn generated_containing_block_size(&self, _: OpaqueFlow) -> LogicalSize<Au>
fn generated_containing_block_size(&self, _: OpaqueFlow) -> LogicalSize<Au>
Return the size of the containing block generated by this flow for the absolutely-
positioned descendant referenced by for_flow
. For block flows, this is the padding box.
NB: Do not change this &self
to &mut self
under any circumstances! It has security
implications because this can be called on parents concurrently from descendants!
sourcefn repair_style(&mut self, new_style: &Arc<ComputedValues>)
fn repair_style(&mut self, new_style: &Arc<ComputedValues>)
Attempts to perform incremental fixup of this flow by replacing its fragment’s style with the new style. This can only succeed if the flow has exactly one fragment.
Provided Methods§
sourcefn as_block(&self) -> &BlockFlow
fn as_block(&self) -> &BlockFlow
If this is a block flow, returns the underlying object. Fails otherwise.
sourcefn as_mut_block(&mut self) -> &mut BlockFlow
fn as_mut_block(&mut self) -> &mut BlockFlow
If this is a block flow, returns the underlying object, borrowed mutably. Fails otherwise.
sourcefn as_flex(&self) -> &FlexFlow
fn as_flex(&self) -> &FlexFlow
If this is a flex flow, returns the underlying object. Fails otherwise.
sourcefn as_inline(&self) -> &InlineFlow
fn as_inline(&self) -> &InlineFlow
If this is an inline flow, returns the underlying object. Fails otherwise.
sourcefn as_mut_inline(&mut self) -> &mut InlineFlow
fn as_mut_inline(&mut self) -> &mut InlineFlow
If this is an inline flow, returns the underlying object, borrowed mutably. Fails otherwise.
sourcefn as_table_wrapper(&self) -> &TableWrapperFlow
fn as_table_wrapper(&self) -> &TableWrapperFlow
If this is a table wrapper flow, returns the underlying object. Fails otherwise.
sourcefn as_mut_table(&mut self) -> &mut TableFlow
fn as_mut_table(&mut self) -> &mut TableFlow
If this is a table flow, returns the underlying object, borrowed mutably. Fails otherwise.
sourcefn as_table(&self) -> &TableFlow
fn as_table(&self) -> &TableFlow
If this is a table flow, returns the underlying object. Fails otherwise.
sourcefn as_mut_table_colgroup(&mut self) -> &mut TableColGroupFlow
fn as_mut_table_colgroup(&mut self) -> &mut TableColGroupFlow
If this is a table colgroup flow, returns the underlying object, borrowed mutably. Fails otherwise.
sourcefn as_table_colgroup(&self) -> &TableColGroupFlow
fn as_table_colgroup(&self) -> &TableColGroupFlow
If this is a table colgroup flow, returns the underlying object. Fails otherwise.
sourcefn as_mut_table_rowgroup(&mut self) -> &mut TableRowGroupFlow
fn as_mut_table_rowgroup(&mut self) -> &mut TableRowGroupFlow
If this is a table rowgroup flow, returns the underlying object, borrowed mutably. Fails otherwise.
sourcefn as_table_rowgroup(&self) -> &TableRowGroupFlow
fn as_table_rowgroup(&self) -> &TableRowGroupFlow
If this is a table rowgroup flow, returns the underlying object. Fails otherwise.
sourcefn as_mut_table_row(&mut self) -> &mut TableRowFlow
fn as_mut_table_row(&mut self) -> &mut TableRowFlow
If this is a table row flow, returns the underlying object, borrowed mutably. Fails otherwise.
sourcefn as_table_row(&self) -> &TableRowFlow
fn as_table_row(&self) -> &TableRowFlow
If this is a table row flow, returns the underlying object. Fails otherwise.
sourcefn as_mut_table_cell(&mut self) -> &mut TableCellFlow
fn as_mut_table_cell(&mut self) -> &mut TableCellFlow
If this is a table cell flow, returns the underlying object, borrowed mutably. Fails otherwise.
sourcefn as_table_cell(&self) -> &TableCellFlow
fn as_table_cell(&self) -> &TableCellFlow
If this is a table cell flow, returns the underlying object. Fails otherwise.
sourcefn bubble_inline_sizes(&mut self)
fn bubble_inline_sizes(&mut self)
Pass 1 of reflow: computes minimum and preferred inline-sizes.
Recursively (bottom-up) determine the flow’s minimum and preferred inline-sizes. When called on this flow, all child flows have had their minimum and preferred inline-sizes set. This function must decide minimum/preferred inline-sizes based on its children’s inline- sizes and the dimensions of any boxes it is responsible for flowing.
sourcefn assign_inline_sizes(&mut self, _ctx: &LayoutContext<'_>)
fn assign_inline_sizes(&mut self, _ctx: &LayoutContext<'_>)
Pass 2 of reflow: computes inline-size.
sourcefn assign_block_size(&mut self, _ctx: &LayoutContext<'_>)
fn assign_block_size(&mut self, _ctx: &LayoutContext<'_>)
Pass 3a of reflow: computes block-size.
sourcefn fragment(
&mut self,
layout_context: &LayoutContext<'_>,
_fragmentation_context: Option<FragmentationContext>,
) -> Option<Arc<dyn Flow>>
fn fragment( &mut self, layout_context: &LayoutContext<'_>, _fragmentation_context: Option<FragmentationContext>, ) -> Option<Arc<dyn Flow>>
Like assign_block_size
, but is recurses explicitly into descendants.
Fit as much content as possible within available_block_size
.
If that’s not all of it, truncate the contents of self
and return a new flow similar to self
with the rest of the content.
The default is to make a flow “atomic”: it can not be fragmented.
sourcefn place_float_if_applicable(&mut self)
fn place_float_if_applicable(&mut self)
If this is a float, places it. The default implementation does nothing.
sourcefn assign_block_size_for_inorder_child_if_necessary(
&mut self,
layout_context: &LayoutContext<'_>,
parent_thread_id: u8,
_content_box: LogicalRect<Au>,
) -> bool
fn assign_block_size_for_inorder_child_if_necessary( &mut self, layout_context: &LayoutContext<'_>, parent_thread_id: u8, _content_box: LogicalRect<Au>, ) -> bool
Assigns block-sizes in-order; or, if this is a float, places the float. The default implementation simply assigns block-sizes if this flow might have floats in. Returns true if it was determined that this child might have had floats in or false otherwise.
parent_thread_id
is the thread ID of the parent. This is used for the layout tinting
debug mode; if the block size of this flow was determined by its parent, we should treat
it as laid out by its parent.
fn has_non_invertible_transform_or_zero_scale(&self) -> bool
fn get_overflow_in_parent_coordinates(&self) -> Overflow
sourcefn store_overflow(&mut self, _: &LayoutContext<'_>)
fn store_overflow(&mut self, _: &LayoutContext<'_>)
CSS Section 11.1 This is the union of rectangles of the flows for which we define the Containing Block.
FIXME(pcwalton): This should not be a virtual method, but currently is due to a compiler
bug (“the trait Sized
is not implemented for self
”).
Assumption: This is called in a bottom-up traversal, so kids’ overflows have already been set. Assumption: Absolute descendants have had their overflow calculated.
sourcefn compute_stacking_relative_position(&mut self, _: &LayoutContext<'_>)
fn compute_stacking_relative_position(&mut self, _: &LayoutContext<'_>)
Phase 4 of reflow: Compute the stacking-relative position (origin of the content box, in coordinates relative to the nearest ancestor stacking context).
sourcefn mark_as_root(&mut self)
fn mark_as_root(&mut self)
Marks this flow as the root flow. The default implementation is a no-op.
fn is_root(&self) -> bool
sourcefn positioning(&self) -> Position
fn positioning(&self) -> Position
The ‘position’ property of this flow.
fn contains_positioned_fragments(&self) -> bool
fn contains_relatively_positioned_fragments(&self) -> bool
sourcefn is_absolute_containing_block(&self) -> bool
fn is_absolute_containing_block(&self) -> bool
Returns true if this is an absolute containing block.
sourcefn contains_roots_of_absolute_flow_tree(&self) -> bool
fn contains_roots_of_absolute_flow_tree(&self) -> bool
Returns true if this flow contains fragments that are roots of an absolute flow tree.
sourcefn print_extra_flow_children(&self, _: &mut PrintTree)
fn print_extra_flow_children(&self, _: &mut PrintTree)
Print any extra children (such as fragments) contained in this Flow for debugging purposes. Any items inserted into the tree will become children of this flow.
fn clipping_and_scrolling(&self) -> ClippingAndScrolling
Implementations§
source§impl dyn Flow
impl dyn Flow
pub fn compute_layout_damage(&mut self) -> SpecialRestyleDamage
pub fn reflow_entire_document(&mut self)
Trait Implementations§
source§impl<'a> ImmutableFlowUtils for &'a dyn Flow
impl<'a> ImmutableFlowUtils for &'a dyn Flow
source§fn is_block_like(self) -> bool
fn is_block_like(self) -> bool
Returns true if this flow is a block flow or subclass thereof.
source§fn is_table_row(self) -> bool
fn is_table_row(self) -> bool
Returns true if this flow is a table row flow.
source§fn is_table_cell(self) -> bool
fn is_table_cell(self) -> bool
Returns true if this flow is a table cell flow.
source§fn is_table_colgroup(self) -> bool
fn is_table_colgroup(self) -> bool
Returns true if this flow is a table colgroup flow.
Returns true if this flow is a table caption flow.
source§fn is_table_rowgroup(self) -> bool
fn is_table_rowgroup(self) -> bool
Returns true if this flow is a table rowgroup flow.
source§fn child_count(self) -> usize
fn child_count(self) -> usize
Returns the number of children that this flow possesses.
source§fn is_block_flow(self) -> bool
fn is_block_flow(self) -> bool
Returns true if this flow is a block flow.
source§fn is_inline_flow(self) -> bool
fn is_inline_flow(self) -> bool
Returns true if this flow is an inline flow.
source§fn print_with_tree(self, print_tree: &mut PrintTree)
fn print_with_tree(self, print_tree: &mut PrintTree)
Dumps the flow tree for debugging into the given PrintTree.
source§fn floats_might_flow_through(self) -> bool
fn floats_might_flow_through(self) -> bool
fn baseline_offset_of_last_line_box_in_flow(self) -> Option<Au>
source§impl<'a> MutableFlowUtils for &'a mut dyn Flow
impl<'a> MutableFlowUtils for &'a mut dyn Flow
source§fn repair_style_and_bubble_inline_sizes(self, style: &Arc<ComputedValues>)
fn repair_style_and_bubble_inline_sizes(self, style: &Arc<ComputedValues>)
Calls repair_style
and bubble_inline_sizes
. You should use this method instead of
calling them individually, since there is no reason not to perform both operations.