CSS Layout Engine that implements Box/Flex/Grid
| Module | Passed | Total | Rate |
|---|---|---|---|
| Flexbox | 543 | 609 | 89.2% |
| Block | 204 | 226 | 90.3% |
| Grid | 268 | 331 | 81.0% |
| Total | 1015 | 1166 | 87.0% |
| Module | Passed | Total | Rate |
|---|---|---|---|
| CSS Parser | 332 | 332 | 100% |
| CSS Selector | 62 | 62 | 100% |
| CSS Media Query | 41 | 41 | 100% |
| Module | Passed | Total | Rate |
|---|---|---|---|
| css-flexbox | 236 | 367 | 64.3% |
| css-grid | 26 | 39 | 66.7% |
| css-tables | 13 | 74 | 17.6% |
| css-display | 14 | 93 | 15.1% |
| css-sizing | 48 | 103 | 46.6% |
| css-position | 59 | 117 | 50.4% |
| css-overflow | 56 | 118 | 47.5% |
| css-contain | 125 | 315 | 39.7% |
| css-variables | 25 | 152 | 16.4% |
| Total | 602 | 1378 | 43.7% |
npm run wpt:fetch-all # Fetch all WPT tests
npm run wpt:run-all # Run all WPT tests| Benchmark | Time |
|---|---|
| Simple HTML (100 elements) | ~27 µs |
| Large document (100 sections × 20 paragraphs) | ~5.2 ms |
| Attribute-heavy (200 elements, 6 attrs each) | ~390 µs |
| Table (100×20 cells) | ~990 µs |
moon bench -p htmlmoon add mizchi/crater// Parse HTML and render layout
///|
let html = "<div style=\"display: flex; width: 300px;\"><div style=\"flex: 1\">A</div><div style=\"flex: 2\">B</div></div>"
///|
let ctx = @renderer.RenderContext::default()
///|
let layout = @renderer.render(html, ctx)
// layout contains x, y, width, height for each elementfn compute_element_shift(before : BoundingRect, after : BoundingRect, viewport : Size[Double]) -> LayoutShiftfn compute_total_cls(before : Array[BoundingRect], after : Array[BoundingRect], viewport : Size[Double]) -> DoubleInstall
Download zipCSS Layout Engine that implements Box/Flex/Grid