Vixen
02b45cc4
csharp
public sealed class StyleUpdater

Holds every element's computed style, and keeps it that way as the tree changes.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Two passes and they are the same code. A cold pass resolves every element; an incremental one resolves the elements a change could have reached and then keeps going only where the answer actually moved. The second is a subset of the first, which is the property the gate checks.

The stopping rule is the whole design. Re-resolving an element gives back an interned ComputedStyle, so "did anything change" is ReferenceEquals — and if it did not, no descendant can have changed by inheritance either, so the walk stops. That is what makes [doc 09](../../docs/plan/09-ui-framework.md)'s reference comparison load-bearing rather than a nicety: without it, every invalidation would have to assume the worst and descend to the leaves.

Fields and properties (2)

  • public int LastPassResolved

    How many elements were cascaded by the last pass.

  • public int LastPassStopped

    How many elements the last pass visited without needing to descend past them.

Methods (6)

  • public StyleUpdater(StyleEngine engine)

    Creates an updater over an engine.

  • public ComputedStyle StyleOf(StyleNodeId element)

    An element's current computed style.

  • public void ResolveAll()

    Resolves every element from scratch.

  • public int ClassChanged(StyleNodeId element, params ReadOnlySpan<string> changedClasses)

    Restyles what a change to an element's classes could have reached.

  • public int StateChanged(StyleNodeId element)

    Restyles what a change to an element's pseudo state could have reached.

  • public void Compact(ReadOnlySpan<int> remap)

    Moves the resolved styles to follow a compacted tree.

Used by (4)

  • CompactionTestsVixen.Ui.Styling.Tests
  • IncrementalRestyleOracleTestsVixen.Ui.Styling.Tests
  • InvalidationTestsVixen.Ui.Styling.Tests
  • UiDocumentVixen.Ui