Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nicoburns
approved these changes
Oct 27, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BaseDocument::newenables Stylo prefs withstyle_config::set_pref!"before creating the Stylist", but the default user-agent stylesheet is parsed before that point and only once:UserAgentStylesheet::default_sheet()is aLazyLockaroundUserAgentStylesheet::parse(DEFAULT_CSS).DocumentConfig::default()callsdefault_sheet(), so the UA sheet is parsed beforeBaseDocument::newsets any pref.As a result, every pref-gated declaration in
assets/default.cssis dropped at parse time, and it stays dropped for the life of the process. For example,ul, ol, menu { counter-reset: list-item; }is lost, becausecounter-reset/counter-incrementare gated bylayout.css.counters.enabledin the pinned Stylo. Author stylesheets are parsed later and are not affected, so the problem only shows up for UA rules.Observed: the computed
counter-resetof an<ol>was empty. When the prefs are set before the UA parse, it islist-item 0.Fix
set_pref!block out ofBaseDocument::newintoinit_stylo_prefs(), guarded bystd::sync::Once. The prefs and values are unchanged, including thewriting-modefeature-gated ones.UserAgentStylesheet::parse, so the default sheet and any custom UA sheet are parsed with the prefs on.BaseDocument::new, so documents built without a UA sheet still get the prefs.No behaviour change for author styles. No new dependencies.
Measured impact
WPT run (
cargo run -rp wpt) on a fork CI, comparing this branch againstmainat fe33b77 on the same runner:css/css-lists,css/css-contain,css/css-writing-modesandhtml/rendering(2,690 tests).That is expected: list markers do not read the
list-itemcounter today, so the UA counter rules are now present but not yet consumed. This change is a prerequisite for CSS-counter-based list numbering, such asol[reversed],<li value>and authorcounter-reset/counter-incrementonlist-item. Without it, that work would see the UA defaults missing.WPT results
No changes in test results compared to
main.Generated by the WPT workflow.