Vixen
02b45cc4
csharp
public sealed class StyleTree

Everything about an element that a selector can ask about.

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

Remarks

Not the element tree — that is Vixen.Ui's, and it does not exist yet. This is the same arrangement Vixen.Ui.Layout uses: the subsystem owns a dense store keyed by an Int32, and the element that arrives later holds one id per store. It is what lets the matcher be built and judged on its own, which [doc 02](../../docs/plan/02-repository-layout.md) gives as the reason these projects are split this finely in the first place.

Plain managed arrays rather than NativeArray, unlike the layout store, and the reason is the shape of the data rather than taste: a class list is variable-length, the matcher's inner loop is a dictionary probe rather than a linear sweep, and doc 09 puts the element count at 10⁴ rather than the layout store's 10⁵. The struct-of-arrays discipline is worth its complexity where the loops are, and this is not one of those places.

Fields and properties (5)

  • public NameTable Names

    The table this store's names live in.

  • public int Count

    How many slots have ever been used, live and removed alike.

  • public int LiveCount

    How many elements are still in the tree.

  • public int DeadCount

    How many slots removal has left behind.

  • public int ChildArenaLength

    How many entries the child arena holds, reserved space included.

Methods (23)

  • public StyleTree(NameTable names)

    Creates a store.

  • public StyleNodeId CreateElement(string tag, StyleNodeId? parent = null, string? id = null, params ReadOnlySpan<string> classNames)

    Adds an element.

  • public bool IsAlive(StyleNodeId element)

    Whether an element is still in the tree.

  • public void Remove(StyleNodeId element)

    Removes an element and everything under it.

  • public int Compact(Span<int> remap)

    Rebuilds the store without the slots removal left behind.

  • public void Move(StyleNodeId element, int index)

    Moves an element to another position among its siblings.

  • public void SetAttribute(StyleNodeId element, string name, string value)

    Sets an attribute.

  • public void SetState(StyleNodeId element, ElementState state)

    Sets the transient state a selector can ask about.

  • public void SetInlineStyle(StyleNodeId element, InlineStyleId? style)

    Gives an element declarations of its own, or takes them away.

  • public InlineStyleId? GetInlineStyle(StyleNodeId element)

    An element's inline block, if it has one.

  • public InlineStyleId? InlineAt(int index)

    An element's inline block by slot, for the resolve pass.

  • public bool AddClass(StyleNodeId element, string className)

    Adds a class to an element.

  • public bool RemoveClass(StyleNodeId element, string className)

    Removes a class from an element.

  • public bool HasClass(StyleNodeId element, string className)

    Whether an element carries a class.

  • public ElementState GetState(StyleNodeId element)

    The transient state of an element.

  • public string GetTagName(StyleNodeId element)

    An element's tag name.

  • public string? GetAttribute(StyleNodeId element, string name)

    An attribute's value, if the element carries it.

  • public string? GetId(StyleNodeId element)

    An element's id attribute.

  • public string[] GetClassNames(StyleNodeId element)

    An element's classes, in the order they were added.

  • public (string Name, string Value)[] GetAttributes(StyleNodeId element)

    An element's attributes, in the order they were set.

  • public StyleNodeId GetParent(StyleNodeId element)

    An element's parent, or Invalid.

  • public int GetChildCount(StyleNodeId element)

    How many children an element has.

  • public StyleNodeId GetChild(StyleNodeId element, int index)

    One child of an element.

Used by (35)

  • AnimationTestsVixen.Ui.Styling.Tests
  • BridgeFixtureVixen.Ui.Tests
  • BuildContextVixen.Ui
  • CascadeFixtureVixen.Ui.Styling.Tests
  • CascadeOrderTestsVixen.Ui.Styling.Tests
  • ChildArenaTestsVixen.Ui.Styling.Tests
  • CompactionTestsVixen.Ui.Styling.Tests
  • CompositionTestsVixen.Ui.Tests
  • ComputedStyleTestsVixen.Ui.Styling.Tests
  • IncrementalRestyleOracleTestsVixen.Ui.Styling.Tests
  • InvalidationTestsVixen.Ui.Styling.Tests
  • MultipleAnimationTestsVixen.Ui.Styling.Tests
  • PathTestsVixen.Ui.Tests
  • RemovalTestsVixen.Ui.Tests
  • ReparentTestsVixen.Ui.Tests
  • RuleIndexVixen.Ui.Styling
  • SelectorMatcherVixen.Ui.Styling
  • SelectorMatchingTestsVixen.Ui.Styling.Tests
  • SelectorOracleTestsVixen.Ui.Styling.Tests
  • SelectorQueryVixen.Ui.Testing
  • ShorthandExpansionTestsVixen.Ui.Styling.Tests
  • StyleEngineVixen.Ui.Styling
  • StyleFixtureVixen.Ui.Styling.Tests
  • StyleInvalidatorVixen.Ui.Styling
  • StyleResolverVixen.Ui.Styling
  • StyleSharingOracleTestsVixen.Ui.Styling.Tests
  • StyleSheetLoadingTestsVixen.Ui.Styling.Tests
  • StyleUpdaterVixen.Ui.Styling
  • ThemeAndScannerTestsVixen.Ui.Styling.Utilities.Tests
  • TransitionTestsVixen.Ui.Styling.Tests
  • UiDocumentVixen.Ui
  • UiElementVixen.Ui
  • UiTestVixen.Ui.Testing
  • UtilityFixtureVixen.Ui.Styling.Utilities.Tests
  • UtilityGenerationTestsVixen.Ui.Styling.Utilities.Tests