Skip to content

Crate split phase 3b: split generated properties into a types half and a machinery half - #10

Draft
nicoburns wants to merge 1 commit into
devin/1785852309-crate-split-3from
devin/1785852309-crate-split-4
Draft

Crate split phase 3b: split generated properties into a types half and a machinery half#10
nicoburns wants to merge 1 commit into
devin/1785852309-crate-split-3from
devin/1785852309-crate-split-4

Conversation

@nicoburns

Copy link
Copy Markdown
Member

Summary

Implements the "option 3" cut of the generated property code: properties.mako.rs now renders twice into two files that are both include!d into the same crate::properties::generated module, so every existing path keeps working while the generated code is physically partitioned along the future stylo_values / stylo_properties crate boundary.

  • properties_structs.rs (types half, ~56k lines servo): longhand value types (longhands::<prop>::{SpecifiedValue, computed_value, parse, get_initial_value, ...}), style_structs, ComputedValues/ComputedValuesInner, StyleStructRef, StyleBuilder.
  • properties.rs (machinery half, ~63k lines servo): PropertyDeclaration, shorthands, LonghandId/ShorthandId/PropertyId ext impls + logical mapping, CASCADE_PROPERTY/parse tables, animated_properties, gecko module, descriptors, size tests.

Key mechanical changes:

  • build.py renders the template with half="types" and half="machinery"; sections are wrapped in % if half == ... guards.
  • The per-longhand cascade_property / parse_declared functions move out of longhands::<prop> into a new generated longhands_machinery::<prop> module (they reference PropertyDeclaration); the generated dispatch tables now point there. Nothing handwritten referenced them directly.
  • ComputedValues methods that need PropertyDeclaration/resolved-serialization (computed_or_resolved_value, property_value_to_typed_value_list, computed_or_resolved_declaration, transition_properties) move to a machinery-side impl ComputedValues block.
  • Vector longhands' SpecifiedValue::compute_iter becomes pub so the machinery half can call it.

Remaining upward references in the types half (to be untangled before the actual crate extraction, next PR): StyleBuilder.stylist: Option<&Stylist>, ComputedValues.rules: Option<StrongRuleNode>, pseudo: Option<PseudoElement>, custom_properties, and the gecko style structs (still generated in the machinery half's gecko module and re-exported).

Verified: cargo check --workspace clean (0 warnings), cargo test --workspace --exclude stylo passes, gecko-engine template renders successfully.

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

The properties.mako.rs template now renders twice: a 'types' half
(longhand value types, style structs, ComputedValues, StyleBuilder)
written to properties_structs.rs, and a 'machinery' half
(PropertyDeclaration, parsing, shorthands, cascade, animated
properties, descriptors) written to properties.rs. Both are included
into the same crate::properties::generated module, so all existing
paths keep working; per-longhand cascade_property/parse_declared move
to a new longhands_machinery module.
@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