Crate split phase 3b: split generated properties into a types half and a machinery half - #10
Draft
nicoburns wants to merge 1 commit into
Draft
Conversation
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.
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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
Implements the "option 3" cut of the generated property code:
properties.mako.rsnow renders twice into two files that are bothinclude!d into the samecrate::properties::generatedmodule, so every existing path keeps working while the generated code is physically partitioned along the futurestylo_values/stylo_propertiescrate 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/PropertyIdext impls + logical mapping,CASCADE_PROPERTY/parse tables,animated_properties, gecko module, descriptors, size tests.Key mechanical changes:
build.pyrenders the template withhalf="types"andhalf="machinery"; sections are wrapped in% if half == ...guards.cascade_property/parse_declaredfunctions move out oflonghands::<prop>into a new generatedlonghands_machinery::<prop>module (they referencePropertyDeclaration); the generated dispatch tables now point there. Nothing handwritten referenced them directly.ComputedValuesmethods that needPropertyDeclaration/resolved-serialization (computed_or_resolved_value,property_value_to_typed_value_list,computed_or_resolved_declaration,transition_properties) move to a machinery-sideimpl ComputedValuesblock.SpecifiedValue::compute_iterbecomespubso 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'sgeckomodule and re-exported).Verified:
cargo check --workspaceclean (0 warnings),cargo test --workspace --exclude stylopasses, gecko-engine template renders successfully.Link to Devin session: https://app.devin.ai/sessions/5d2d6be20e724623bdc1bcf7e1687af1
Requested by: @nicoburns