1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//! `cssbox-core` — A standalone CSS layout engine.
//!
//! This crate implements CSS layout algorithms: block, inline, float,
//! positioning, flexbox, grid, and table. It takes a tree of styled nodes
//! as input and produces computed positions and sizes as output.
//!
//! # Usage
//!
//! ```rust
//! use cssbox_core::tree::BoxTreeBuilder;
//! use cssbox_core::style::ComputedStyle;
//! use cssbox_core::geometry::Size;
//! use cssbox_core::layout::{compute_layout, FixedWidthTextMeasure};
//!
//! let mut builder = BoxTreeBuilder::new();
//! let root = builder.root(ComputedStyle::block());
//! // ... add children ...
//! let tree = builder.build();
//!
//! let result = compute_layout(&tree, &FixedWidthTextMeasure, Size::new(800.0, 600.0));
//! let root_rect = result.bounding_rect(tree.root());
//! ```