No description
  • Rust 98.5%
  • Python 1.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
gjz010's OpenCode agent ecba749fa5
Add owner-local CSS dialect and Sciter star sizes
Add crate::parser::CssDialect, an owner-supplied syntax policy that defaults
to Strict and is set only by callers that need Sciter compatibility. Retain
the consuming declaration's dialect through UnparsedValue so var() substitution
keeps the same grammar, and add Stylesheet/StylesheetContents
from_str_with_dialect entry points while leaving existing constructors on
Strict.

Add a StarWeight to generic Size and parse_physical_size for width/height, so
SciterCompat alone accepts '*' and positive integer weights for physical sizes;
logical sizes, min/max, margin and flex-basis keep upstream grammar. Computed
Size::Star participates in TryTacticAdjustment without changing upstream arms.

Local fork of servo/stylo at 34d25f7417.
2026-10-30 22:00:56 +08:00
.github/workflows Commit our changes on top of upstream Stylo 2026-09-09 19:54:12 +02:00
malloc_size_of Upgrade to rust-phf 0.14 and intermediate dependencies (#460) 2026-09-15 07:21:45 +00:00
selectors Bump stylo to 0.22.0, and more (#473) 2026-09-30 10:21:58 +00:00
servo_arc Bump stylo to 0.22.0, and more (#473) 2026-09-30 10:21:58 +00:00
style Add owner-local CSS dialect and Sciter star sizes 2026-10-30 22:00:56 +08:00
style_derive Commit our changes on top of upstream Stylo 2026-09-09 19:54:12 +02:00
style_traits Commit our changes on top of upstream Stylo 2026-09-09 19:54:12 +02:00
stylo_atoms Upgrade to rust-phf 0.14 and intermediate dependencies (#460) 2026-09-15 07:21:45 +00:00
stylo_dom Commit our changes on top of upstream Stylo 2026-09-09 19:54:12 +02:00
stylo_static_prefs Enable layout.css.alpha-color-function.enabled by default (#469) 2026-09-28 19:10:10 +00:00
to_shmem Bump stylo to 0.22.0, and more (#473) 2026-09-30 10:21:58 +00:00
to_shmem_derive Bump stylo to 0.22.0, and more (#473) 2026-09-30 10:21:58 +00:00
.gitignore Servo initial downstream commit 2026-09-07 22:38:13 +02:00
Cargo.toml Bump stylo to 0.22.0, and more (#473) 2026-09-30 10:21:58 +00:00
commit-from-merge.sh Servo initial downstream commit 2026-09-07 22:38:13 +02:00
commit-from-squashed.sh Servo initial downstream commit 2026-09-07 22:38:13 +02:00
README.md Commit our changes on top of upstream Stylo 2026-09-09 19:54:12 +02:00
rustfmt.toml Bug 1983500: remove binop_separator from rustfmt config and reformat stylo (r=dshin) 2025-08-18 13:23:01 +00:00
shell.nix Servo initial downstream commit 2026-09-07 22:38:13 +02:00
start-rebase.sh Servo initial downstream commit 2026-09-07 22:38:13 +02:00
style.paths Servo initial downstream commit 2026-09-07 22:38:13 +02:00
sync.sh Commit our changes on top of upstream Stylo 2026-09-09 19:54:12 +02:00
SYNCING.md Commit our changes on top of upstream Stylo 2026-09-09 19:54:12 +02:00

Stylo

High-Performance CSS Style Engine

Build Status Crates.io Docs Crates.io License

Stylo is a high-performance, browser-grade CSS style engine written in Rust that powers Servo and Firefox. This repo contains Servo’s downstream version of Stylo. The upstream version lives in mozilla-central with the rest of the Gecko/Firefox codebase.

Coordination of Stylo development happens:

  • Here in Github Issues
  • In the #stylo channel of the Servo Zulip
  • In the #layout room of the Mozilla Matrix instance (matrix.mozilla.org)

High-Level Documentation

  • This Mozilla Hacks article contains a high-level overview of the Stylo architecture.
  • There is a chapter in the Servo Book (although it is a little out of date).

Branches

The branches are as follows:

  • upstream has upstream mozilla-central filtered to the paths we care about (style.paths), but is otherwise unmodified.
  • main adds our downstream patches, plus the scripts and workflows for syncing with mozilla-central on top of upstream.

Warning

This repo syncs from upstream by creating a new branch and then rebasing our changes on top of it. This means that git pull will not work across syncs (you will need to use git fetch, git reset and git rebase).

More information on the syncing process is available in SYNCING.md

Crates

A guide to the crates contained within this repo

Stylo Crates

These crates are largely implementation details of Stylo, although you may need to use some of them directly if you use Stylo.

Directory Crate Notes
style Crates.io The main Stylo crate containing the entire CSS engine
style_traits Crates.io Types and traits which allow other code to interoperate with Stylo without depending on the main crate directly.
stylo_dom Crates.io Similar to stylo_traits (but much smaller)
stylo_atoms Crates.io Atoms for CSS and HTML event related strings
stylo_static_prefs Crates.io Configuration for Stylo. Can be used to set runtime preferences (enabling/disabling properties, etc)
style_derive Crates.io Internal derive macro for stylo crate

Standalone Crates

These crates form part of Stylo but are also be useful standalone.

Directory Crate Notes
selectors Crates.io CSS Selector matching
servo_arc Crates.io A variant on std::Arc

You may also be interested in the cssparser crate which lives in the servo/rust-cssparser repo.

Support Crates

Low-level crates which could technically be used standalone but are unlikely to be generally useful in practice.

Directory Crate Notes
malloc_size_of Crates.io Heap size measurement for Stylo values
to_shmem Crates.io Internal utility crate for sharing memory across processes.
to_shmem_derive Crates.io Internal derive macro for to_shmem crate

Building Servo Against a Local Copy of Stylo

Assuming your local servo and stylo directories are siblings, you can build servo against stylo by adding the following to servo/Cargo.toml:

[patch."https://github.com/servo/stylo"]
selectors = { path = "../stylo/selectors" }
servo_arc = { path = "../stylo/servo_arc" }
stylo = { path = "../stylo/style" }
stylo_atoms = { path = "../stylo/stylo_atoms" }
stylo_dom = { path = "../stylo/stylo_dom" }
stylo_malloc_size_of = { path = "../stylo/malloc_size_of" }
stylo_static_prefs = { path = "../stylo/stylo_static_prefs" }
stylo_traits = { path = "../stylo/style_traits" }

Releases

Releases are made every time this repository rebases its changes on top of the latest version of upstream Stylo. There are a lot of crates here. In order to publish them, they must be done in order. One order that works is:

  • selectors
  • stylo_static_prefs
  • stylo_atoms
  • stylo_malloc_size_of
  • stylo_dom
  • stylo_derive
  • stylo_traits
  • stylo

License

Stylo is licensed under MPL 2.0