Skip to main content

Module fc

Module fc 

Source
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

  1. Constants & Types - Magic numbers as named constants, core types
  2. Entry Point - layout_formatting_context dispatcher
  3. BFC Layout - Block formatting context implementation
  4. IFC Layout - Inline formatting context implementation
  5. Table Layout - Table formatting context implementation
  6. Flex/Grid Layout - Taffy bridge wrappers
  7. 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.
BorderInfo
Information about a border for conflict resolution
FloatingContext
Manages the state of all floated elements within a Block Formatting Context.
LayoutConstraints
Input constraints for a layout function.
LayoutOutput
The result of laying out a formatting context.
LayoutResult
Result of a formatting context layout operation
MarginCollapseContext
Manages vertical margin collapsing within a BFC.
TableCellInfo
Information about a table cell for layout
TableColumnInfo
Lays out a Table Formatting Context. Table column information for layout calculations

Enums§

BorderSource
Source of a border in the border conflict resolution algorithm
OverflowBehavior
The CSS overflow property behavior.
TextAlign
Text alignment options

Constants§

SCROLLBAR_WIDTH_PX
Default scrollbar width in pixels (CSS Overflow Module Level 3). Used when overflow: scroll or overflow: auto triggers 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