Vixen
02b45cc4
csharp
public static class CascadeRanks

Builds the precedence of a declaration.

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

Remarks

The origin ranks below are CSS Cascading 5 §6.2 read straight down, and the shape worth noticing is the mirror. Normal declarations run user-agent → user → author → inline; important ones run inline → author → user → user-agent. It is not decoration: a user stylesheet that marks a font size important is a player who needs it, and it has to be able to beat a game that also marked one important. Importance is not "wins", it is "reverse the order of who is trusted".

Layers mirror the same way, and unlayered styles sit at the strong end of whichever direction is in force. Both reversals are covered by tests that would pass just as happily if either were left out, which is why they are separate tests naming the behaviour rather than one test asserting a winner.

Animations and transitions have their own tiers in the same table — above all normal declarations and above all important ones respectively — and are not written yet. The gaps between the numbers are where they go.

Fields and properties (10)

  • public const int NormalUserAgent

    Normal declarations from Vixen's own control styles.

  • public const int NormalUser

    Normal declarations from a player's overrides.

  • public const int NormalAuthor

    Normal declarations from the game's stylesheets.

  • public const int NormalInline

    Normal declarations written on the element itself.

  • public const int Animation

    Where a running animation's declarations will sit.

  • public const int ImportantInline

    !important declarations written on the element itself.

  • public const int ImportantAuthor

    !important declarations from the game's stylesheets.

  • public const int ImportantUser

    !important declarations from a player's overrides.

  • public const int ImportantUserAgent

    !important declarations from Vixen's own control styles.

  • public const int Transition

    Where a running transition's declarations will sit.

Methods (2)

  • public static int Of(StyleOrigin origin, bool important)

    The rank of a declaration from a stylesheet rule.

  • public static int OfInline(bool important)

    The rank of a declaration written on the element itself.

Used by (1)

  • StyleResolverVixen.Ui.Styling