Vixen
dd8b0a81
csharp
public sealed class StyleEngine

The whole styling pipeline, assembled.

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

Remarks

The parts are separate because each one is worth testing on its own — the matcher against a brute-force oracle, the cascade against CSS's own ordering rules, the sharing cache against a resolver that does not share. They are also useless separately, and every one of them needs the same four interning tables. This puts them together once.

Three name tables rather than one. Selector names, property names and value texts are different namespaces, and folding them together would make the ancestor bloom's domain include every colour in the stylesheet — a filter over a much larger set of names is a filter that rejects less.

Fields and properties (21)

  • public int SheetCount

    How many stylesheets have been loaded.

  • public NameTable Names

    The table selector names are interned in.

  • public NameTable Properties

    The table property names are interned in.

  • public NameTable Values

    The table declaration values are interned in.

  • public SelectorTable Selectors

    The flat store compiled selectors point into.

  • public SelectorCompiler Compiler

    The ExCSS selector visitor.

  • public StyleRuleSet Rules

    The loaded rules.

  • public SelectorMatcher Matcher

    The selector matcher.

  • public ComputedStyleCache Interning

    Where computed styles are interned.

  • public InlineStyleStore InlineStyles

    The declarations written on elements themselves.

  • public KeyframesTable Keyframes

    The @keyframes rules.

  • public StyleSheetLoader Loader

    The stylesheet loader.

  • public StyleResolver Resolver

    The cascade.

  • public StyleTree Tree

    The element store.

  • public Animator Animations

    Runs the transitions and the @keyframes animations.

  • public MediaConditions Conditions

    The conditional groups the loaded sheets declared.

  • public MediaScopes Scopes

    Everywhere the rules are being shown, and what @media answers on each.

  • public ContainerConditions Containers

    The @container groups the loaded sheets declared.

  • public ContainerScopes ContainerScopes

    Every container chain the document has, and what @container answers in each.

  • public MediaContext Media

    What @media is evaluated against for sheets that did not name a context.

  • public Func<string, string>? Preprocessor

    A transform every sheet's text goes through on its way to the parser.

Methods (9)

  • public StyleEngine()

    Creates an engine with nothing loaded.

  • public bool SetMedia(MediaContext media)

    Re-evaluates every @media block against a new primary surface.

  • public bool SetMedia(int scope, MediaContext media)

    Tells one surface what it is now, and re-evaluates @media there.

  • public int Load(string css, StyleOrigin origin = Author, MediaContext? media = null)

    Loads a stylesheet.

  • public void Replace(int sheet, string css)

    Replaces a loaded sheet with new text.

  • public string SheetText(int sheet)

    The text a sheet was loaded from.

  • public void Reload()

    Rebuilds the rule set from the sheets as they now read.

  • public InlineStyleId AddInlineStyle(ReadOnlySpan<Declaration> declarations)

    Records declarations written on an element itself.

  • public ComputedStyle[] ResolveAll()

    Resolves every element in the tree, parents before children.

Used by (63, showing 40)

  • AccessibilityWiringTestsVixen.Platform.Ui.Tests
  • AnimationTestsVixen.Ui.Styling.Tests
  • ApplyAtInstallTestsVixen.Ui.Styling.Utilities.Tests
  • BridgeFixtureVixen.Ui.Tests
  • BuildContextVixen.Ui
  • CascadeFixtureVixen.Ui.Styling.Tests
  • CascadeOrderTestsVixen.Ui.Styling.Tests
  • ChildScopedFamilyTestsVixen.Ui.Styling.Utilities.Tests
  • ClassSelectorReachTestsVixen.Ui.Styling.Tests
  • CombinatorPairTestsVixen.Ui.Styling.Tests
  • CompactionTestsVixen.Ui.Styling.Tests
  • CompositionTestsVixen.Ui.Styling.Utilities.Tests
  • CompositionTestsVixen.Ui.Tests
  • ComputedStyleTestsVixen.Ui.Styling.Tests
  • ContainerQueryTestsVixen.Ui.Styling.Tests
  • ContainerWiringTestsVixen.Ui.Tests
  • DrawListTestsVixen.Ui.Tests
  • EmitterTestsVixen.Ui.Markup.Tests
  • ForcedColorsTestsVixen.Ui.Tests
  • HarnessVixen.Ui.Controls.Tests
  • HasInvalidationTestsVixen.Ui.Styling.Tests
  • HotReloadHostVixen.Ui.HotReload
  • HotReloadWatcherVixen.Ui.HotReload
  • HotReloadWatcherTestsVixen.Ui.HotReload.Tests
  • IncrementalDocumentTestsVixen.Ui.Tests
  • IncrementalRestyleOracleTestsVixen.Ui.Styling.Tests
  • InitialValueTransitionTestsVixen.Ui.Styling.Tests
  • InlineStyleTestsVixen.Ui.Tests
  • MediaContextTestsVixen.Ui.Tests
  • MultipleAnimationTestsVixen.Ui.Styling.Tests
  • PathTestsVixen.Ui.Tests
  • PerSurfaceMediaTestsVixen.Ui.Tests
  • ReducedMotionTestsVixen.Ui.Styling.Tests
  • RefusalExpiryVixen.Ui.Styling.Utilities.Tests
  • RemovalTestsVixen.Ui.Tests
  • ReparentTestsVixen.Ui.Tests
  • RepositoryScanVixen.Ui.Styling.Tests
  • ScopedStyleTestsVixen.Ui.Tests
  • ScrollNamesVixen.Ui.Controls
  • ScrollViewVixen.Ui.Controls