Expand description
solver3/fc.rs - Formatting Context Layout
This module implements the CSS Visual Formatting Model’s formatting contexts:
-
Block Formatting Context (BFC): CSS 2.2 § 9.4.1 Block-level boxes in normal flow, with margin collapsing and float positioning.
-
Inline Formatting Context (IFC): CSS 2.2 § 9.4.2 Inline-level content (text, inline-blocks) laid out in line boxes.
-
Table Formatting Context: CSS 2.2 § 17 Table layout with column width calculation and cell positioning.
-
Flex/Grid Formatting Contexts: CSS Flexbox/Grid via Taffy Delegated to the Taffy layout engine for modern layout modes.
§Module Organization
- Constants & Types - Magic numbers as named constants, core types
- Entry Point -
layout_formatting_contextdispatcher - BFC Layout - Block formatting context implementation
- IFC Layout - Inline formatting context implementation
- Table Layout - Table formatting context implementation
- Flex/Grid Layout - Taffy bridge wrappers
- Helper Functions - Property getters, margin collapsing, utilities
Structs§
- BfcState
- Manages all layout state for a single Block Formatting Context. This struct is created by the BFC root and lives for the duration of its layout.
- Border
Info - Information about a border for conflict resolution
- Floating
Context - Manages the state of all floated elements within a Block Formatting Context.
- Layout
Constraints - Input constraints for a layout function.
- Layout
Output - The result of laying out a formatting context.
- Layout
Result - Result of a formatting context layout operation
- Margin
Collapse Context - Manages vertical margin collapsing within a BFC.
- Table
Cell Info - Information about a table cell for layout
- Table
Column Info - Lays out a Table Formatting Context. Table column information for layout calculations
Enums§
- Border
Source - Source of a border in the border conflict resolution algorithm
- Overflow
Behavior - The CSS
overflowproperty behavior. - Text
Align - Text alignment options
Constants§
- SCROLLBAR_
WIDTH_ PX - Default scrollbar width in pixels (CSS Overflow Module Level 3).
Used when
overflow: scrolloroverflow: autotriggers scrollbar display.
Functions§
- check_
scrollbar_ necessity - Helper to determine if scrollbars are needed.
- layout_
formatting_ context - Main dispatcher for formatting context layout.
- layout_
table_ fc - Main function to layout a table formatting context
- translate_
taffy_ point_ back - translate_
taffy_ size_ back