Expand description
Flow layout, also known as block-and-inline layout.
ModulesΒ§
StructsΒ§
- Block
Formatting πContext - Collapsible
With πParent Start Margin - Containing
Block πPadding AndBorder - Independent
Float πOrAtomic Layout Result - Outside
Marker π - The contentes of a BlockContainer created to render a list marker
for a list that has
list-style-position: outside
. - Placement
State π - State that we maintain when placing blocks.
- Resolved
Margins π
EnumsΒ§
- Block
Container π - Block
Level πBox
FunctionsΒ§
- automatic_
inline_ πsize - Determines the automatic size for the inline axis of a block-level box. https://drafts.csswg.org/css-sizing-3/#automatic-size
- block_
size_ πis_ zero_ or_ intrinsic - compute_
inline_ πcontent_ sizes_ for_ block_ level_ boxes - Finds the min/max-content inline size of the block-level children of a block container. The in-flow boxes will stack vertically, so we only need to consider the maximum size. But floats can flow horizontally depending on βclearβ, so we may need to sum their sizes. CSS 2 does not define the exact algorithm, this logic is based on the behavior observed on Gecko and Blink.
- justify_
self_ πalignment - Justifies a block-level box, distributing the free space according to
justify-self
. Note<center>
and<div align>
are implemented via internal βtext-alignβ values, which are also handled here. The provided free space should already take margins into account. In particular, it should be zero if there is an auto margin. https://drafts.csswg.org/css-align/#justify-block - layout_
block_ πlevel_ children - layout_
block_ πlevel_ children_ in_ parallel - layout_
block_ πlevel_ children_ sequentially - layout_
in_ πflow_ non_ replaced_ block_ level_ same_ formatting_ context - Lay out a normal flow non-replaced block that does not establish a new formatting context.
- resolve_
justify_ πself - Resolves the
justify-self
value, preserving flags. - solve_
block_ πmargins_ for_ in_ flow_ block_ level - Resolves βautoβ margins of an in-flow block-level box in the block axis. https://drafts.csswg.org/css2/#normal-block https://drafts.csswg.org/css2/#block-root-margin
- solve_
containing_ πblock_ padding_ and_ border_ for_ in_ flow_ box - Given the style for an in-flow box and its containing block, determine the containing block for its children. Note that in the presence of floats, this shouldnβt be used for a block-level box that establishes an independent formatting context (or is replaced), since the inline size could then be incorrect.
- solve_
inline_ πmargins_ avoiding_ floats - Resolves βautoβ margins of an in-flow block-level box in the inline axis similarly to |solve_inline_margins_for_in_flow_block_level|. However, they align within the provided rect (instead of the containing block), to avoid overlapping floats. In addition to the used margins, it also returns the effective margin-inline-start (see ContainingBlockPaddingAndBorder). It may differ from the used inline-start margin if the computed value wasnβt βautoβ and there are floats to avoid or the box is justified. See https://github.com/w3c/csswg-drafts/issues/9174
- solve_
inline_ πmargins_ for_ in_ flow_ block_ level - Resolves βautoβ margins of an in-flow block-level box in the inline axis, distributing the free space in the containing block.
- solve_
margins π - Given the containing block and size of an in-flow box, determine the margins. Note that in the presence of floats, this shouldnβt be used for a block-level box that establishes an independent formatting context (or is replaced), since the margins could then be incorrect.