Something went wrong. Try again.
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980//! Every value the engine has for a table when it calls the `table_grid_rows` generated//! function, under the one name and type each value has, and the fixed fields of the//! function's answer.//!//! The function's types file (`table_grid_rows_types.rs`) is written by a model, and the//! engine fills its inputs struct without knowing in advance which values it holds: the call//! site (`fragment.rs` `layout_table_children`) builds a [`TableGridRowsEngineValues`], and//! `table_grid_rows::inputs_from`, which `build.rs` writes from the types file in place,//! copies each field the inputs struct declares from the field of the same name here. So a//! types file's inputs struct may only take fields of [`TableGridRowsEngineValues`], under//! the same names and types, and its outputs struct has exactly the fields of//! [`TableGridRowsEngineAnswer`]. `job-check types --engine` checks both on the file alone//! (`jobs/src/types_file.rs` `check_names`).//!//! The inputs borrow the per-row and per-cell lists for a lifetime, named `'a` in both the//! engine's struct and the types file's. The types a field names (`TableGridRowInput`,//! `TableGridCellHeight`, `TableRow`) are the engine's own and live in//! `crate::table_grid_rows` and `crate::table`, which a types file imports from.//!//! The grid is already built and every cell laid out at the width of the columns it spans://! the function sees each cell's border-box height from its content, and the rows and row//! spans, never an HTML attribute or an anonymous box.//!//! A value whose doc has a paragraph opening `Needed:` is one the specification's rules//! read whenever the specification text says one of the quoted phrases in it: a types//! file written from that text takes the value. `job-check types --engine <file>//! --specification <folder>` refuses a types file that does not while the text says the//! phrase (`jobs/src/types_file.rs` `check_needs`).
use crate::table::TableRow;use crate::table_grid_rows::{TableGridCellHeight, TableGridRowInput};
/// Every value the engine has worked out for the table at the call, and nothing else.#[derive(Debug, Clone, Copy, PartialEq)]pub struct TableGridRowsEngineValues<'a> { /// The vertical `border-spacing`, in px: the gap between adjacent rows and between the /// table's content edge and the row beside it. Zero in the collapsing-borders model. /// /// Needed: the specification text says "border-spacing". pub border_spacing: f64, /// The table's top padding, in px. pub padding_top: f64, /// The table's bottom padding, in px. pub padding_bottom: f64, /// The table's top border width, in px. pub border_top: f64, /// The table's bottom border width, in px. pub border_bottom: f64, /// The table's own `height` as a border-box length in px when it is definite (a /// percentage resolved against the containing block, `box-sizing` folded in); `None` for /// `auto` and for a percentage with no definite basis. /// /// Needed: the specification text says "'height' property of the table". pub height: Option<f64>, /// Every row of the table, in layout order, header group first and footer group last. /// /// Needed: the specification text says "row". pub rows: &'a [TableGridRowInput], /// Every cell of the table, in document order, with the row it starts in, the rows it /// spans and the border-box height its content gave it. /// /// Needed: the specification text says "cell". pub cells: &'a [TableGridCellHeight],}
/// The fields of the function's answer, which the engine reads by these names: a types/// file's outputs struct declares exactly these.#[derive(Debug, Clone, PartialEq)]pub struct TableGridRowsEngineAnswer { /// One row per entry of the table's `rows`, in order: its height in px, which is the /// height of every cell that starts in it and spans only it, and its top edge as a /// distance down from the table's content-box origin, in px, `border-spacing` included. /// A cell spanning several rows is as tall as those rows and the gaps between them; the /// engine adds the gaps. The engine places a cell where its first row starts. pub rows: Vec<TableRow>, /// The table's used border-box height, in px, padding and border included. The engine /// makes the box at least this tall, whatever its `height` said. pub used_height: f64,}