Module style::values::computed::length_percentage

source ·
Expand description

<length-percentage> computed values, and related ones.

The over-all design is a tagged pointer, with the lower bits of the pointer being non-zero if it is a non-calc value.

It is expected to take 64 bits both in x86 and x86-64. This is implemented as a union, with 4 different variants:

  • The length and percentage variants have a { tag, f32 } (effectively) layout. The tag has to overlap with the lower 2 bits of the calc variant.

  • The calc() variant is a { tag, pointer } in x86 (so same as the others), or just a { pointer } in x86-64 (so that the two bits of the tag can be obtained from the lower bits of the pointer).

  • There’s a tag variant just to make clear when only the tag is intended to be read. Note that the tag needs to be masked always by TAG_MASK, to deal with the pointer variant in x86-64.

The assertions in the constructor methods ensure that the tag getter matches our expectations.

Structs§

  • The representation of a calc() function with mixed lengths and percentages.
  • A <length-percentage> value. This can be either a <length>, a <percentage>, or a combination of both via calc().

Enums§

  • The leaves of a <length-percentage> calc expression.
  • An unpacked <length-percentage> that owns the calc() variant, for serialization purposes.
  • Tag 🔒
  • Unpacked 🔒
    An unpacked <length-percentage> that borrows the calc() variant.
  • An unpacked <length-percentage> that mutably borrows the calc() variant.

Functions§

Type Aliases§