NativeElixirPdfUtilities.Validators.CssSizingValidator (native_elixir_pdf_utilities v1.1.0)

View Source

Owns shared calculated box dimensions and computed root sizing metadata.

Summary

Types

A validated calculation whose percentage dependency remains tied to the containing axis.

Functions

Computes the starting automatic margin from actual free space for a validated axis.

Resolves final authored automatic margins numerically while retaining their axis intent.

Prepares general box size arithmetic through the shared CSS calculation grammar.

Retains computed root dimensions without changing document canvas paint semantics.

Resolves box calculations against selected font metrics and the actual containing dimension.

Validates prepared box calculations including their genuine percentage dependency.

Validates canonical automatic-margin flags for computed styles and root sizing.

Checks calculation metadata in externally supplied computed styles before used-size resolution.

Checks canonical root sizing metadata before layout uses a genuine page or child viewport.

Types

calculation()

@type calculation() :: {:css_size_math, {String.t(), boolean()}}

A validated calculation whose percentage dependency remains tied to the containing axis.

Functions

auto_margin_offset(style, axis, free, policy)

@spec auto_margin_offset(map(), :width | :height, number(), :flow | :positioned) ::
  number()

Computes the starting automatic margin from actual free space for a validated axis.

prepare_auto_margins(style)

@spec prepare_auto_margins(map()) :: map()

Resolves final authored automatic margins numerically while retaining their axis intent.

prepare_math(value)

@spec prepare_math(term()) ::
  {:ok, calculation()}
  | :error
  | {:error, NativeElixirPdfUtilities.Diagnostics.detailed_error()}

Prepares general box size arithmetic through the shared CSS calculation grammar.

prepare_root(style)

@spec prepare_root(map() | nil) :: map() | nil

Retains computed root dimensions without changing document canvas paint semantics.

resolve_math(arg, basis, style)

@spec resolve_math(calculation(), number() | nil, map()) ::
  {:ok, number() | nil}
  | {:error, NativeElixirPdfUtilities.Diagnostics.detailed_error()}

Resolves box calculations against selected font metrics and the actual containing dimension.

valid_calculation?(value)

@spec valid_calculation?(term()) :: boolean()

Validates prepared box calculations including their genuine percentage dependency.

validate_auto_margins(style, source)

@spec validate_auto_margins(map(), String.t()) :: :ok | {:error, {atom(), map()}}

Validates canonical automatic-margin flags for computed styles and root sizing.

validate_calculations(style, source)

@spec validate_calculations(map(), String.t()) ::
  :ok | {:error, NativeElixirPdfUtilities.Diagnostics.detailed_error()}

Checks calculation metadata in externally supplied computed styles before used-size resolution.

validate_root(root)

@spec validate_root(term()) :: :ok | {:error, {atom(), map()}}

Checks canonical root sizing metadata before layout uses a genuine page or child viewport.