Skip to main content

browsy_core/
lib.rs

1pub mod dom;
2pub mod css;
3pub mod layout;
4pub mod output;
5pub mod js;
6#[cfg(feature = "fetch")]
7pub mod fetch;
8
9use output::SpatialDom;
10
11/// Parse an HTML string and compute the Spatial DOM.
12/// This is the primary entry point for browsy-core.
13pub fn parse(html: &str, viewport_width: f32, viewport_height: f32) -> SpatialDom {
14    let dom_tree = dom::parse_html(html);
15    let styled = css::compute_styles_with_viewport(&dom_tree, viewport_width, viewport_height);
16    let laid_out = layout::compute_layout(&styled, viewport_width, viewport_height);
17    output::generate_spatial_dom(&laid_out, viewport_width, viewport_height)
18}