pub struct BoxModel {
pub width: Option<f64>,
pub height: Option<f64>,
pub x: f64,
pub y: f64,
pub margins: Insets,
pub border_width: f64,
pub min_width: f64,
pub max_width: f64,
pub min_height: f64,
pub max_height: f64,
pub caption: Option<Caption>,
}Expand description
The XFA Box Model for a form element.
XFA Spec 3.3 §2.6 (p49-50) — Nominal extent is w × h. Inside: margins → border inset → caption region → content region. The Nominal Content Region is the area after margins are applied.
§8 Growability (p275-276): a container is growable if it omits h and/or w:
- h=✓ w=✓ → fixed, not growable (minH/maxH/minW/maxW ignored)
- h=✓ w=∅ → growable along X only (minH/maxH ignored)
- h=∅ w=✓ → growable along Y only (minW/maxW ignored)
- h=∅ w=∅ → growable along both axes Default: minH=0, minW=0, maxH=infinity, maxW=infinity.
See spec figure “Relationship between nominal extent and borders, margins, captions, and content” (p50).
TODO(§2.6): border inset not modeled separately — currently merged with margins.
Fields§
§width: Option<f64>Nominal width (None = growable).
height: Option<f64>Nominal height (None = growable).
x: f64Explicit x position (for positioned layout).
y: f64Explicit y position (for positioned layout).
margins: InsetsMargins.
border_width: f64Border thickness (simplified to uniform for now).
min_width: f64Minimum width constraint.
max_width: f64Maximum width constraint.
min_height: f64Minimum height constraint.
max_height: f64Maximum height constraint.
caption: Option<Caption>Caption region.
Implementations§
Source§impl BoxModel
impl BoxModel
Sourcepub fn content_width(&self) -> f64
pub fn content_width(&self) -> f64
The available content width after subtracting margins, borders, and caption.
Sourcepub fn content_height(&self) -> f64
pub fn content_height(&self) -> f64
The available content height after subtracting margins, borders, and caption.
Sourcepub fn outer_size(&self, content: Size) -> Size
pub fn outer_size(&self, content: Size) -> Size
The outer extent (total bounding box).