kozan_core/layout/mod.rs
1//! Layout engine — computes size and position for every element.
2//!
3//! Chrome equivalent: `blink/renderer/core/layout/` + `ng/` (`LayoutNG`).
4//!
5//! # Architecture (DOM IS the layout tree)
6//!
7//! ```text
8//! DOM Tree (Document) Fragment Tree
9//! ─────────────────── ──────────────
10//! Storage<LayoutNodeData> (final positions)
11//! .style (taffy::Style)
12//! .cache (taffy::Cache) ──layout()──► Fragment (Arc, immutable)
13//! .layout_children TextFragment
14//! .unrounded_layout Fragment
15//!
16//! Taffy reads/writes LayoutNodeData
17//! directly via DocumentLayoutView
18//! ```
19//!
20//! No separate `LayoutTree`. Taffy's trait implementations
21//! (`LayoutPartialTree`, `CacheTree`, etc.) are on `DocumentLayoutView`
22//! which wraps `&mut Document` + `&LayoutContext`.
23//!
24//! # Module structure
25//!
26//! | Module | Purpose |
27//! |--------|---------|
28//! | [`node_data`] | Per-node layout data (style, cache, layout results) |
29//! | [`document_layout`] | Taffy trait impls on Document, resolve pipeline |
30//! | [`fragment`] | Immutable output flowing up |
31//! | [`result`] | Algorithm output wrapper |
32//! | `algo::shared` | ComputedValues → taffy::Style conversion |
33//! | [`inline`] | Text measurement, font system |
34//! | [`hit_test`](mod@hit_test) | Fragment tree hit testing |
35
36pub mod algo;
37pub mod box_model;
38pub mod context;
39pub mod document_layout;
40pub mod fragment;
41pub mod hit_test;
42pub mod inline;
43pub mod node_data;
44pub mod result;
45
46// Re-exports.
47pub use context::LayoutContext;
48pub use fragment::{
49 BoxFragmentData, ChildFragment, Fragment, FragmentKind, LineFragmentData, OverflowClip,
50 PhysicalInsets, TextFragmentData,
51};
52pub use hit_test::HitTestResult;
53pub use inline::{FontHeight, FontMetrics, TextMeasurer, TextMetrics, resolve_line_height};
54pub use node_data::LayoutNodeData;
55pub use result::{IntrinsicSizes, LayoutResult};