Skip to content

Crate split phase 1: stylo_build codegen crate + property IDs and small types into stylo_traits - #6

Draft
nicoburns wants to merge 3 commits into
mainfrom
devin/1785852309-crate-split
Draft

Crate split phase 1: stylo_build codegen crate + property IDs and small types into stylo_traits#6
nicoburns wants to merge 3 commits into
mainfrom
devin/1785852309-crate-split

Conversation

@nicoburns

Copy link
Copy Markdown
Member

Summary

Phase 1 of splitting the stylo crate into smaller crates for compile-time (pipelining) wins. This PR moves the codegen pipeline and the "small types everything names" down below the main crate, keeping the style:: API unchanged via re-exports.

  • New stylo_build crate: the mako/python property-codegen pipeline (build.py, data.py, templates, property TOMLs, vendored python) moves out of style/ into a shared [build-dependencies] crate exposing generate_properties(engine) and a new generate_property_ids(engine) target. Single source of truth for property data; multiple crates can now run codegen into their own OUT_DIR.
  • Property ID enums generated into stylo_traits: a new property_ids.mako.rs template renders LonghandId, ShorthandId, NonCustomPropertyId, AliasId, LogicalGroupId, PrioritaryPropertyId, CountedUnknownProperty, property_counts, and the ID-set machinery (LonghandIdSet etc.) into style_traits::property_ids.
  • Higher-layer ID methods become extension traits in the generated properties code (since inherent impls must live with the type):
    // generated in style::properties
    trait NonCustomPropertyIdExt { fn allowed_in(&ParserContext)...; }
    trait LonghandIdExt { fn parse_value(...) -> PropertyDeclaration; fn to_physical(WritingMode)...; }
    trait ShorthandIdExt { fn parse_into(...); fn longhands_to_css(...); }
    trait ShorthandIdSerializationExt { fn get_shorthand_appendable_value(...); }
    ToComputedValue/ToResolvedValue for the ID enums are now trivial_to_computed_value!/trivial_to_resolved_value! in the main crate instead of derives.
  • Small neutral types move to stylo_traits: Origin/OriginSet/PerOrigin (style_traits::origin), CssRuleType/CssRuleTypes/CorsMode (style_traits::rule_types). Old paths re-exported.
  • Gecko's property-enabled pref check (which reads a gecko_bindings static) is behind a runtime-installed function pointer (set_gecko_property_enabled_fn) so stylo_traits doesn't depend on the bindings.

No behavior change intended; style::properties::LonghandId etc. remain available at their old paths.

Later phases (stacked on this PR) will extract stylo_common, stylo_values, and stylo_properties.

Link to Devin session: https://app.devin.ai/sessions/5d2d6be20e724623bdc1bcf7e1687af1
Requested by: @nicoburns

@nicoburns nicoburns self-assigned this Aug 4, 2026
@devin-ai-integration

Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant