Blitz is a modular HTML/CSS rendering engine (Stylo for style, Taffy for layout, Parley for text, anyrender/Vello/Skia for paint) used by Dioxus Native. Rust workspace.
Linux needs build-essential pkg-config python3 libssl-dev libfontconfig-dev (see CONTRIBUTING.MD).
Before pushing, run what CI runs:
cargo fmt --all --checkcargo clippy --workspace -- -D warningscargo clippy -p blitz-dom --no-default-features --features svg,woff,accessibility,system-fonts,file-input,custom-widget --all-targets -- -D warningscargo test --workspaceRUSTDOCFLAGS="-D warnings" cargo docand, if you touchedCargo.toml,cargo deny --workspace --all-features --locked check licenses- If you touched
.github/scripts:python3 -m unittest discover -s .github/scripts
Don't use --all-features for clippy/test: rdme/avif needs system dav1d >= 1.3 and accesskit_xplat/tokio conflicts with accesskit_xplat/async-io. Pass an explicit feature list instead.
Run apps/browser with cargo run -p browser (not the built binary directly), or its asset! stylesheet doesn't load.
Headless machines: the default GPU renderer has no adapter. Prefer rendering to an image (cargo run --release --example screenshot <file-or-url>); for a window use the softbuffer CPU renderer (--no-default-features --features cpu-softbuffer; the cpu just recipes use cpu-pixels, which still requires wgpu).
WPT is the main correctness signal; results are deterministic.
- Don't add tests for features WPT already covers (most style, layout and rendering changes). The WPT results are the test.
- Clone https://github.com/web-platform-tests/wpt and check out the commit in
wpt/WPT_COMMIT, thenWPT_DIR=<path> cargo run -rp wpt <test paths or globs>(orjust wpt ...). Arguments are paths/globs, not filename prefixes. Report and rendered PNGs land inwpt/output/. RUST_LOG=warnshows uncaught JS errors in testharness tests. A very low subtest count usually means the test failed before reporting.- Tests that a change newly makes reach an unsupported feature and time out go in
wpt/runner/timeout-quarantine.txt(<path> <reason>, reusing an existing reason) in the same PR. They're skipped unless--run-quarantined. - CI posts a WPT diff into the PR description between
<!-- wpt-results-start -->/<!-- wpt-results-end -->. Don't remove those markers when you edit a PR body. - To check what browsers do:
https://wpt.fyi/api/search?q=<path>&label=master&label=stable&product=chrome&product=firefox&product=safari.
- Where a change needs a test WPT doesn't provide, put it in
tests/blitz-testsrather than in crate unit tests, wherever possible. - Keep tests minimal: a few focused cases, not a generated suite.
- Avoid whole-tree passes (loops over every node) where possible, especially on hot paths like
resolve(). Incremental rendering performance depends on doing work proportional to what changed: track dirty nodes or use existing damage/flags instead. - Attribute changes only get layout damage from the computed-style diff. If box construction or layout reads an attribute directly (inline SVG source,
<col span>, form attributes, ...), add it to theread_by_layoutlist inrestyle_for_attribute_change(mutator.rs), or invalidation silently breaks. The*-change/*-invalidationreftests catch this. - Facts about a node derived from its children belong in box-tree construction flags (
NodeFlags, reset inreset_construction_flags), not recomputed at paint time. - There's no CSS 2.1 block-in-inline split: an inline box containing blocks is laid out as a block. Inline
img/svg/inputstill paint throughrender_element. apps/browserpaints pages as sub-documents (draw_sub_documentruns its ownpaint_scene). Any extra top-level paint pass also has to run per sub-document, or it works in examples but not in the browser.- Generated form-control content must be layout-only anonymous content, not real DOM children (those are visible to selectors/scripts and break WPT).
- Human-written PR descriptions are preferred. Write a short plain-prose explanation of what changed and why, the way a person would. Skip generated boilerplate, heading templates and file-by-file change lists.
- One feature per PR; follow-ups go in a new PR. Don't implement unrelated features to fix WPT losses. Note the losses in the PR description instead.
- Search existing PRs before starting on a missing feature (
gh pr list --state all --search <feature>); there are often stacks already open. - Don't add
Co-Authored-By: Claudeor similar AI-attribution git trailers to commits. - Fixes in Taffy/Parley/anyrender/Stylo go upstream in those repos, not patched in Blitz.