//! Every value the engine has for a box when it calls the `width` 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 (`width_types.rs`) is written by a model, and the engine fills //! its inputs struct without knowing in advance which values it holds: the call sites //! (`fragment.rs` `layout_box_styled`, which calls once for the width and again for a box //! whose `aspect-ratio` gave it another width) build a [`WidthEngineValues`], and //! `width::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 [`WidthEngineValues`], under the same names and //! types, and its outputs struct has exactly the fields of [`WidthEngineAnswer`]. `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`). /// Every value the engine has worked out for the box at the call, and nothing else. #[derive(Debug, Clone, PartialEq)] pub struct WidthEngineValues { /// Source: computed style `width` of `self`, its form, unresolved: `Length` in px, `Percentage` as a fraction (`50%` is `0.5`), or one of `Calc` (a `calc()` mixing a length and a percentage), `Auto`, `None`, `MinContent`, `MaxContent`, `FitContent`, `Stretch` and `Other`. pub width: dom::computed::ComputedLength, /// Source: computed style `margin-left` of `self`, its form, unresolved: `Length` in px, `Percentage` as a fraction (`50%` is `0.5`), or one of `Calc` (a `calc()` mixing a length and a percentage), `Auto`, `None`, `MinContent`, `MaxContent`, `FitContent`, `Stretch` and `Other`. pub margin_left: dom::computed::ComputedLength, /// Source: computed style `margin-right` of `self`, its form, unresolved: `Length` in px, `Percentage` as a fraction (`50%` is `0.5`), or one of `Calc` (a `calc()` mixing a length and a percentage), `Auto`, `None`, `MinContent`, `MaxContent`, `FitContent`, `Stretch` and `Other`. pub margin_right: dom::computed::ComputedLength, /// Source: computed style `border-left-width` of `self`, in px. pub border_left_width: f64, /// Source: computed style `padding-left` of `self`, in px. pub padding_left: f64, /// Source: computed style `padding-right` of `self`, in px. pub padding_right: f64, /// Source: computed style `border-right-width` of `self`, in px. pub border_right_width: f64, /// Source: `rect.width` of the `containing_block` function's answer for this box, in px: the width of the rect the box's containing block covers. pub containing_block_width: f64, /// Source: computed style `direction` of `containing-block`, the box the `containing_block` function's answer names in `ancestor`; the empty string when it names no box. pub containing_block_direction: String, /// Source: computed style `min-width` of `self`, its form, unresolved: `Length` in px, `Percentage` as a fraction (`50%` is `0.5`), or one of `Calc` (a `calc()` mixing a length and a percentage), `Auto`, `None`, `MinContent`, `MaxContent`, `FitContent`, `Stretch` and `Other`. pub min_width: dom::computed::ComputedLength, /// Source: computed style `max-width` of `self`, its form, unresolved: `Length` in px, `Percentage` as a fraction (`50%` is `0.5`), or one of `Calc` (a `calc()` mixing a length and a percentage), `Auto`, `None`, `MinContent`, `MaxContent`, `FitContent`, `Stretch` and `Other`. pub max_width: dom::computed::ComputedLength, } /// 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 WidthEngineAnswer { /// the box's used content-box width, whatever its 'box-sizing'; the engine puts it on the 1/64 px grid, adds the horizontal padding and border for the border box, and lays the box's children out in that content width pub used_width: f64, /// the used 'margin-left'; the engine places the box's border box this far from the containing block's left content edge In px. pub used_margin_left: f64, /// the used 'margin-right'; the engine does not place anything by it In px. pub used_margin_right: f64, }