//! Every value the engine has for a box when it calls the `height` generated function, //! under the one name and type each value has, and the fixed field of the function's //! answer. //! //! The function's types file (`height_types.rs`) is written by a model, and the engine //! fills its inputs struct without knowing in advance which values it holds: the three //! call sites (`fragment.rs` `layout_box`, the table cell loop and `layout_absolute_box`) //! build a [`HeightEngineValues`], and `height::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 //! [`HeightEngineValues`], under the same names and types, and its outputs struct has //! exactly the fields of [`HeightEngineAnswer`]. `job-check types --engine` checks both on //! the file alone (`jobs/src/types_file.rs` `check_names`). //! //! The list holds more than the function needs on purpose: choosing which values the //! specification's rules read is the types file's work. A value not listed here is not //! available at the call, because the engine does not compute it at that point. //! //! 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 //! --specification ` refuses a types file that does not while the text says the //! phrase (`jobs/src/types_file.rs` `check_needs`). use dom::computed::LengthPercentageOrAuto; /// Every value the engine has worked out for the box at the call, and nothing else. #[derive(Debug, Clone, Copy, PartialEq)] pub struct HeightEngineValues { /// The computed `height` after percentage resolution against the containing block's /// height, in px when a `Length`. `Length` measures the box `box-sizing` names (the /// border box when `border_box_sizing` holds, the content box otherwise); `Auto` is the /// keyword, an intrinsic-sizing keyword (`min-content`, `max-content`, `fit-content`), /// and the value the absolute-positioning call site hands over to ask for the box's /// automatic height whatever its own `height` says; `Percentage` is a percentage that /// found no definite containing block height to resolve against (CSS 2.1 10.5 treats it /// as `auto`); `Unresolved` is a `calc()` mixing a length and a percentage. /// /// Needed: the specification text says "'height'". pub resolved_height: LengthPercentageOrAuto, /// Whether the box establishes a block formatting context, the condition CSS 2.1 10.6.7 /// gates the lowest float's extension on. /// /// Needed: the specification text says "block formatting context". pub establishes_bfc: bool, /// The distance, in px, from the box's content top edge to the bottom margin edge of /// its last in-flow child, as the stacking walk measured it (CSS 2.1 10.6.3). `0.0` for /// a box with no in-flow child. /// /// Needed: the specification text says "bottom margin edge of its last in-flow child". pub content_height_from_children: f64, /// The bottom margin edge of the lowest float in the block formatting context the box /// owns, in px from its content top edge, or `None` when it establishes no context of /// its own. A box that establishes one but holds no float carries `Some(0.0)`. /// /// Needed: the specification text says "lowest float". pub lowest_float_bottom: Option, /// Whether the computed `box-sizing` is `border-box` rather than `content-box`. /// /// Needed: the specification text says "box-sizing". pub border_box_sizing: bool, /// Top plus bottom padding and border, in px: what a `border-box` `height` gives back /// to become a content height. pub edge_tb: f64, /// The computed `min-height` in px, measuring the box `box-sizing` names, after any /// percentage resolved against the containing block's height; `None` for `auto`, for a /// percentage with no definite containing block height (CSS 2.1 10.7 treats it as `0`), /// and for an unresolved `calc()`. The table cell and absolutely positioned box call /// sites do not give it, so it is `None` there. /// /// Needed: the specification text says "'min-height'". pub min_height: Option, /// The computed `max-height` in px, in the form `min_height` has; `None` for `none`, for /// a percentage with no definite containing block height (CSS 2.1 10.7 treats it as /// `none`), and for an unresolved `calc()`. /// /// Needed: the specification text says "'max-height'". pub max_height: Option, } /// 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, Copy, PartialEq)] pub struct HeightEngineAnswer { /// The box's used content-box height, in px. The engine puts it on the 1/64 px grid /// itself where it becomes the box's used height. pub content_height: f64, }