Crate split phase 3a: funnel all values -> engine accesses through computed::Context methods - #9
Draft
nicoburns wants to merge 4 commits into
Draft
Conversation
🤖 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:
|
…tylo_common; PrecomputedHasher into stylo_traits
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
First slice of the
stylo_valuesextraction (stacked on #7): makevalues::computed::Contextthe single chokepoint between value-computation code and the engine layers above it, so the futureComputationContexttrait boundary is exactly the set of inherent methods onContext.style/values/**no longer pokes intocontext.builder,context.style()orcontext.device()directly. All such accesses (~40 sites) go through new narrowContextmethods:All method bodies are the exact expressions previously inlined at the call sites (no behavior change); e.g.
FontBaseSize::resolvenow just delegates tocontext.font_size(*self).Move the element-context support types down so
Context's fields stop pointing at the dom/context layers:ElementContext,DummyElementContext,AttributeTracker,AttributeReferences,TreeCountingCaches,TreeCountingResult→stylo_common::element_context(re-exported from their oldstyle::dom/style::context/values::computedpaths).impl<T: TElement> ElementContext for Tcan't move (orphan rule) and is replaced by aTElementContext<E>(pub E)adapter instyle::dom, used at the single coercion site inproperties::cascade.PrecomputedHasher/PrecomputedHashMap/PrecomputedHashSet→style_traits::precomputed_hash(re-exported fromstyle::selector_map).Redirect
values/imports of already-moved types to their real homes:LonghandId/LogicalGroupIdetc. fromstyle_traits::property_ids,CorsModefromstyle_traits::rule_types,QuirksModefromselectors::matching, andSpecifiedWritingModefromlogical_geometry::WritingModePropertyinstead of the generatedlonghands::writing_modealias.After this, the only remaining
values -> upper layercouplings are insidecomputed::Context/animated::Context/resolved::Contextthemselves (StyleBuilder,ComputedValues,Device,Stylist, container-query support types) plus a handful of property-ID parse entry points — i.e. the surface that the actual crate boundary will have to abstract.Verified with
cargo check --workspaceandcargo test --workspace --exclude stylo(stylo test target fails onmainfor a preexisting pseudo-element issue).Link to Devin session: https://app.devin.ai/sessions/5d2d6be20e724623bdc1bcf7e1687af1
Requested by: @nicoburns