public sealed class StyleInvalidatorWorks out which elements a change can possibly have restyled.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The premise is that recomputing is not an option. A DataGrid restyles when a row is selected, and if selecting a row cost a pass over ten thousand cells the grid would be unusable — so the question is not "what changed" but "what could a rule have noticed".
Answering it is a static property of the stylesheet. For every name a rule mentions, where does it appear: against the element itself, as an ancestor, before a sibling combinator? And when it appears as an ancestor, what does the far end of that rule test? That last question is the one worth asking — it turns "restyle the subtree" into "restyle the .cells in the subtree".
Nothing needs to look upward. A selector can only reach downward and rightward, because Vixen does not support :has() — the P2 decision in [doc 09](../../docs/plan/09-ui-framework.md), and this is the second thing it buys after match cost. :focus-within is the apparent exception and is not one: it is stored as element state and set explicitly, so it arrives as a change like any other.
Fields and properties (3)
public bool StateReachesDescendantsWhether an element's own state change can be narrowed at all, or whether every rule has to be reconsidered.
public bool StateReachesSiblingsWhether a state change can reach later siblings.
public bool StateReachesEverythingWhether what a state change reaches cannot be narrowed by name.
Methods (3)
public StyleInvalidator(SelectorTable table)Creates an invalidator over a rule set.
public void Read(StyleRuleSet rules)Reads every rule that has been added since the last time.
public void Collect(StyleTree tree, StyleNodeId element, ReadOnlySpan<int> changed, bool stateChanged, List<StyleNodeId> roots)Collects the elements a change to an element could have restyled.
Used by (1)
- StyleUpdaterVixen.Ui.Styling