Struct layout_2013::block::BlockFlow

source ·
#[repr(C)]
pub struct BlockFlow { pub base: BaseFlow, pub fragment: Fragment, pub float: Option<Box<FloatedBlockInfo>>, flags: BlockFlowFlags, }

Fields§

§base: BaseFlow

Data common to all flows.

§fragment: Fragment

The associated fragment.

§float: Option<Box<FloatedBlockInfo>>

Additional floating flow members.

§flags: BlockFlowFlags

Various flags.

Implementations§

source§

impl BlockFlow

source

pub fn from_fragment(fragment: Fragment) -> BlockFlow

source

pub fn from_fragment_and_float_kind( fragment: Fragment, float_kind: Option<FloatKind>, ) -> BlockFlow

source

pub fn block_type(&self) -> BlockType

Return the type of this block.

This determines the algorithm used to calculate inline-size, block-size, and the relevant margins for this Block.

source

pub fn compute_used_inline_size( &mut self, shared_context: &SharedStyleContext<'_>, containing_block_inline_size: Au, )

Compute the actual inline size and position for this block.

source

pub fn fragment(&mut self) -> &mut Fragment

Return this flow’s fragment.

source

pub fn stacking_relative_border_box(&self, coor: CoordinateSystem) -> Rect<Au>

source

pub fn containing_block_size( &self, viewport_size: &Size2D<Au>, descendant: OpaqueFlow, ) -> LogicalSize<Au>

Return the size of the containing block for the given immediate absolute descendant of this flow.

Right now, this only gets the containing block size for absolutely positioned elements. Note: We assume this is called in a top-down traversal, so it is ok to reference the CB.

source

pub fn get_shrink_to_fit_inline_size(&self, available_inline_size: Au) -> Au

Return shrink-to-fit inline-size.

This is where we use the preferred inline-sizes and minimum inline-sizes calculated in the bubble-inline-sizes traversal.

source

fn adjust_fragments_for_collapsed_margins_if_root( &mut self, shared_context: &SharedStyleContext<'_>, )

If this is the root flow, shifts all kids down and adjusts our size to account for root flow margins, which should never be collapsed according to CSS § 8.3.1.

TODO(#2017, pcwalton): This is somewhat inefficient (traverses kids twice); can we do better?

source

fn clone_with_children(&self, new_children: FlowList) -> BlockFlow

source

fn propagate_early_absolute_position_info_to_children(&mut self)

Writes in the size of the relative containing block for children. (This information is also needed to handle RTL.)

source

pub fn assign_block_size_block_base( &mut self, layout_context: &LayoutContext<'_>, fragmentation_context: Option<FragmentationContext>, margins_may_collapse: MarginsMayCollapseFlag, ) -> Option<Arc<dyn Flow>>

Assign block-size for current flow.

  • Collapse margins for flow’s children and set in-flow child flows’ block offsets now that we know their block-sizes.
  • Calculate and set the block-size of the current flow.
  • Calculate block-size, vertical margins, and block offset for the flow’s box using CSS § 10.6.7.

For absolute flows, we store the calculated content block-size for the flow. We defer the calculation of the other values until a later traversal at root flow.

When fragmentation_context is given (not None), this should fit as much of the content as possible within the available block size. If there is more content (that doesn’t fit), this flow is fragmented with the extra content moved to another fragment (a flow like this one) which is returned. See Flow::fragment.

The return value is always None when fragmentation_context is None.

inline(always) because this is only ever called by in-order or non-in-order top-level methods.

source

pub fn place_float(&mut self)

Add placement information about current float flow for use by the parent.

Also, use information given by parent about other floats to find out our relative position.

This does not give any information about any float descendants because they do not affect elements outside of the subtree rooted at this float.

This function is called on a kid flow by a parent. Therefore, assign_block_size_float was already called on this kid flow by the traversal function. So, the values used are well-defined.

source

pub fn explicit_block_containing_size( &self, shared_context: &SharedStyleContext<'_>, ) -> Option<Au>

source

pub fn explicit_block_size( &self, containing_block_size: Option<Au>, ) -> Option<Au>

source

fn calculate_absolute_block_size_and_margins( &mut self, shared_context: &SharedStyleContext<'_>, )

source

fn propagate_and_compute_used_inline_size( &mut self, shared_context: &SharedStyleContext<'_>, )

Compute inline size based using the block_container_inline_size set by the parent flow.

This is run in the AssignISizes traversal.

source

pub fn propagate_assigned_inline_size_to_children<F>( &mut self, shared_context: &SharedStyleContext<'_>, inline_start_content_edge: Au, inline_end_content_edge: Au, content_inline_size: Au, callback: F, )
where F: FnMut(&mut dyn Flow, usize, Au, WritingMode, &mut Au, &mut Au),

Assigns the computed inline-start content edge and inline-size to all the children of this block flow. The given callback, if supplied, will be called once per child; it is currently used to push down column sizes for tables.

#[inline(always)] because this is called only from block or table inline-size assignment and the code for block layout is significantly simpler.

source

pub fn formatting_context_type(&self) -> FormattingContextType

Determines the type of formatting context this is. See the definition of FormattingContextType.

source

fn assign_inline_position_for_formatting_context( &mut self, layout_context: &LayoutContext<'_>, content_box: LogicalRect<Au>, )

Per CSS 2.1 § 9.5, block formatting contexts’ inline widths and positions are affected by the presence of floats. This is the part of the assign-heights traversal that computes the final inline position and width for such flows.

Note that this is part of the assign-block-sizes traversal, not the assign-inline-sizes traversal as one might expect. That is because, in general, float placement cannot occur until heights are assigned. To work around this unfortunate circular dependency, by the time we get here we have already estimated the width of the block formatting context based on the floats we could see at the time of inline-size assignment. The job of this function, therefore, is not only to assign the final size but also to perform the layout again for this block formatting context if our speculation was wrong.

source

fn is_inline_block_or_inline_flex(&self) -> bool

source

fn content_intrinsic_inline_sizes(&self) -> IntrinsicISizes

Computes the content portion (only) of the intrinsic inline sizes of this flow. This is used for calculating shrink-to-fit width. Assumes that intrinsic sizes have already been computed for this flow.

source

pub fn bubble_inline_sizes_for_block(&mut self, consult_children: bool)

Computes intrinsic inline sizes for a block.

source

pub fn overflow_style_may_require_clip_scroll_node(&self) -> bool

source

pub fn compute_inline_sizes(&mut self, shared_context: &SharedStyleContext<'_>)

source

pub fn initialize_container_size_for_root( &mut self, shared_context: &SharedStyleContext<'_>, )

If this is the root flow, initialize values that would normally be set by the parent.

Should be called during assign_inline_sizes for flows that may be the root.

source

fn guess_inline_size_for_block_formatting_context_if_necessary(&mut self)

source

fn definitely_has_zero_block_size(&self) -> bool

source

pub fn is_inline_flex_item(&self) -> bool

source

pub fn is_block_flex_item(&self) -> bool

source

pub fn mark_scrolling_overflow(&mut self, has_scrolling_overflow: bool)

source

pub fn has_scrolling_overflow(&self) -> bool

source

pub fn sticky_position(&self) -> SideOffsets2D<MaybeAuto>

source

pub fn background_border_section(&self) -> DisplayListSection

source§

impl BlockFlow

source

fn transform_clip_to_coordinate_space( &mut self, state: &mut StackingContextCollectionState, preserved_state: &mut SavedStackingContextCollectionState, )

source

fn is_reference_frame(&self, context_type: Option<StackingContextType>) -> bool

Returns true if this fragment may establish a reference frame and this block creates a stacking context. Both are necessary in order to establish a reference frame.

source

pub fn collect_stacking_contexts_for_block( &mut self, state: &mut StackingContextCollectionState, flags: StackingContextCollectionFlags, )

source

fn setup_clipping_for_block( &mut self, state: &mut StackingContextCollectionState, preserved_state: &mut SavedStackingContextCollectionState, stacking_context_type: Option<StackingContextType>, established_reference_frame: Option<ClipScrollNodeIndex>, flags: StackingContextCollectionFlags, ) -> ClippingAndScrolling

source

fn setup_clip_scroll_node_for_position( &mut self, state: &mut StackingContextCollectionState, border_box: Rect<Au>, )

source

fn setup_clip_scroll_node_for_overflow( &mut self, state: &mut StackingContextCollectionState, border_box: Rect<Au>, )

source

fn setup_clip_scroll_node_for_css_clip( &mut self, state: &mut StackingContextCollectionState, preserved_state: &mut SavedStackingContextCollectionState, stacking_relative_border_box: Rect<Au>, )

Adds a scroll root for a block to take the clip property into account per CSS 2.1 § 11.1.2.

source

fn create_pseudo_stacking_context_for_block( &mut self, stacking_context_type: StackingContextType, parent_stacking_context_id: StackingContextId, parent_clipping_and_scrolling: ClippingAndScrolling, state: &mut StackingContextCollectionState, )

source

fn create_real_stacking_context_for_block( &mut self, parent_stacking_context_id: StackingContextId, parent_clipping_and_scrolling: ClippingAndScrolling, established_reference_frame: Option<ClipScrollNodeIndex>, state: &mut StackingContextCollectionState, )

source

pub fn build_display_list_for_block_no_damage( &self, state: &mut DisplayListBuildState<'_>, border_painting_mode: BorderPaintingMode<'_>, )

source

pub fn build_display_list_for_block( &mut self, state: &mut DisplayListBuildState<'_>, border_painting_mode: BorderPaintingMode<'_>, )

source

pub fn build_display_list_for_background_if_applicable_with_background( &self, state: &mut DisplayListBuildState<'_>, background: &Background, background_color: AbsoluteColor, )

source

fn stacking_context_type( &self, flags: StackingContextCollectionFlags, ) -> Option<StackingContextType>

Trait Implementations§

source§

impl Debug for BlockFlow

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Flow for BlockFlow

source§

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 fragments it is responsible for flowing.

source§

fn assign_inline_sizes(&mut self, layout_context: &LayoutContext<'_>)

Recursively (top-down) determines the actual inline-size of child contexts and fragments. When called on this context, the context has had its inline-size set by the parent context.

Dual fragments consume some inline-size first, and the remainder is assigned to all child (block) contexts.

source§

fn positioning(&self) -> Position

The ‘position’ property of this flow.

source§

fn generated_containing_block_size(&self, _: OpaqueFlow) -> LogicalSize<Au>

Return the dimensions of the containing block generated by this flow for absolutely- positioned descendants. For block flows, this is the padding box.

source§

fn contains_roots_of_absolute_flow_tree(&self) -> bool

Returns true if this flow contains fragments that are roots of an absolute flow tree.

source§

fn is_absolute_containing_block(&self) -> bool

Returns true if this is an absolute containing block.

source§

fn class(&self) -> FlowClass

Returns the class of flow that this is.
source§

fn as_mut_block(&mut self) -> &mut BlockFlow

If this is a block flow, returns the underlying object, borrowed mutably. Fails otherwise.
source§

fn as_block(&self) -> &BlockFlow

If this is a block flow, returns the underlying object. Fails otherwise.
source§

fn place_float_if_applicable<'a>(&mut self)

If this is a float, places it. The default implementation does nothing.
source§

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. Read more
source§

fn assign_block_size(&mut self, ctx: &LayoutContext<'_>)

Pass 3a of reflow: computes block-size.
source§

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. Read more
source§

fn compute_stacking_relative_position( &mut self, _layout_context: &LayoutContext<'_>, )

Phase 4 of reflow: Compute the stacking-relative position (origin of the content box, in coordinates relative to the nearest ancestor stacking context).
source§

fn mark_as_root(&mut self)

Marks this flow as the root flow. The default implementation is a no-op.
source§

fn is_root(&self) -> bool

source§

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

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

fn collect_stacking_contexts( &mut self, state: &mut StackingContextCollectionState, )

source§

fn build_display_list(&mut self, state: &mut DisplayListBuildState<'_>)

Phase 5 of reflow: builds display lists.
source§

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

fn compute_overflow(&self) -> Overflow

Returns the union of all overflow rects of all of this flow’s fragments.
source§

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

fn mutate_fragments(&mut self, mutator: &mut dyn FnMut(&mut Fragment))

Mutably iterates through fragments in this flow.
source§

fn print_extra_flow_children(&self, print_tree: &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.
source§

fn as_flex(&self) -> &FlexFlow

If this is a flex flow, returns the underlying object. Fails otherwise.
source§

fn as_inline(&self) -> &InlineFlow

If this is an inline flow, returns the underlying object. Fails otherwise.
source§

fn as_mut_inline(&mut self) -> &mut InlineFlow

If this is an inline flow, returns the underlying object, borrowed mutably. Fails otherwise.
source§

fn as_table_wrapper(&self) -> &TableWrapperFlow

If this is a table wrapper flow, returns the underlying object. Fails otherwise.
source§

fn as_mut_table(&mut self) -> &mut TableFlow

If this is a table flow, returns the underlying object, borrowed mutably. Fails otherwise.
source§

fn as_table(&self) -> &TableFlow

If this is a table flow, returns the underlying object. Fails otherwise.
source§

fn as_mut_table_colgroup(&mut self) -> &mut TableColGroupFlow

If this is a table colgroup flow, returns the underlying object, borrowed mutably. Fails otherwise.
source§

fn as_table_colgroup(&self) -> &TableColGroupFlow

If this is a table colgroup flow, returns the underlying object. Fails otherwise.
source§

fn as_mut_table_rowgroup(&mut self) -> &mut TableRowGroupFlow

If this is a table rowgroup flow, returns the underlying object, borrowed mutably. Fails otherwise.
source§

fn as_table_rowgroup(&self) -> &TableRowGroupFlow

If this is a table rowgroup flow, returns the underlying object. Fails otherwise.
source§

fn as_mut_table_row(&mut self) -> &mut TableRowFlow

If this is a table row flow, returns the underlying object, borrowed mutably. Fails otherwise.
source§

fn as_table_row(&self) -> &TableRowFlow

If this is a table row flow, returns the underlying object. Fails otherwise.
source§

fn as_mut_table_cell(&mut self) -> &mut TableCellFlow

If this is a table cell flow, returns the underlying object, borrowed mutably. Fails otherwise.
source§

fn as_table_cell(&self) -> &TableCellFlow

If this is a table cell flow, returns the underlying object. Fails otherwise.
source§

fn has_non_invertible_transform_or_zero_scale(&self) -> bool

source§

fn get_overflow_in_parent_coordinates(&self) -> Overflow

source§

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. Read more
source§

fn is_fixed(&self) -> bool

Return true if this flow has position ‘fixed’.
source§

fn contains_positioned_fragments(&self) -> bool

source§

fn contains_relatively_positioned_fragments(&self) -> bool

source§

fn clipping_and_scrolling(&self) -> ClippingAndScrolling

source§

impl Serialize for BlockFlow

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl TableLikeFlow for BlockFlow

source§

fn assign_block_size_for_table_like_flow( &mut self, block_direction_spacing: Au, layout_context: &LayoutContext<'_>, )

Lays out the rows of a table.
source§

impl HasBaseFlow for BlockFlow

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> GetBaseFlow for T
where T: HasBaseFlow + ?Sized,

source§

fn base(&self) -> &BaseFlow

source§

fn mut_base(&mut self) -> &mut BaseFlow

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

source§

impl<T> WasmNotSend for T
where T: Send,

source§

impl<T> WasmNotSendSync for T

source§

impl<T> WasmNotSync for T
where T: Sync,