Skip to main content

takumi_core/layout/inline/
metrics.rs

1//! Where an inline formatting context's boxes paint.
2
3/// How an inline box sits in its line.
4#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5pub enum InlineBoxKind {
6  /// An atomic inline on the line.
7  InFlow,
8  /// An absolutely positioned box, at its static position.
9  OutOfFlow,
10  /// A float beside the lines.
11  Float,
12}
13
14#[derive(Clone, Copy, Debug)]
15/// An inline box resolved to its painted position and size.
16pub struct VisualInlineBox {
17  /// Index into the span list.
18  pub id: u64,
19  /// Left edge.
20  pub x: f32,
21  /// Top edge.
22  pub y: f32,
23  /// Box width.
24  pub width: f32,
25  /// Box height.
26  pub height: f32,
27  /// Baseline of the in-flow line that owns this box, relative to the inline formatting context's
28  /// content-box top edge.
29  pub line_baseline: Option<f32>,
30  /// How the box sits in its line.
31  pub kind: InlineBoxKind,
32}