Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155//! Every value the engine has for an absolutely positioned box when it calls the `absolute`//! 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 (`absolute_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_absolute_box`, which calls twice per box) build an//! [`AbsoluteEngineValues`], and `absolute::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//! [`AbsoluteEngineValues`], under the same names and types, and its outputs struct has//! exactly the fields of [`AbsoluteEngineAnswer`]. `job-check types --engine` checks both on//! the file alone (`jobs/src/types_file.rs` `check_names`).//!//! Every length here is already resolved past a percentage against the containing block's//! size, so a field of the `LengthPercentageOrAuto` type holds `Length` or `Auto` (and//! `Unresolved` for a `calc()` mixing a length and a percentage); the containing block is//! chosen by the `containing_block` function before this one is called.//!//! 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 dom::computed::LengthPercentageOrAuto;
use crate::width::Direction;
/// Every value the engine has worked out for the box at the call, and nothing else.#[derive(Debug, Clone, Copy, PartialEq)]pub struct AbsoluteEngineValues { /// The containing block's padding-box width, in px: the nearest positioned ancestor's, /// or the initial containing block's (the viewport's) when there is none. /// /// Needed: the specification text says "containing block". pub containing_block_width: f64, /// The containing block's padding-box height, in px, chosen the same way. /// /// Needed: the specification text says "containing block". pub containing_block_height: f64, /// The offset, in px, from the containing block's padding-box left edge to the left /// margin edge of the box this element would have generated had its `position` been /// `static`. /// /// Needed: the specification text says "static position". pub static_left: f64, /// The offset, in px, from the containing block's padding-box top edge to the top /// margin edge of the box this element would have generated had its `position` been /// `static`. /// /// Needed: the specification text says "static position". pub static_top: f64, /// The computed `top`, a `Length` in px or `Auto`. /// /// Needed: the specification text says "'top'". pub top: LengthPercentageOrAuto, /// The computed `right`, a `Length` in px or `Auto`. /// /// Needed: the specification text says "'right'". pub right: LengthPercentageOrAuto, /// The computed `bottom`, a `Length` in px or `Auto`. /// /// Needed: the specification text says "'bottom'". pub bottom: LengthPercentageOrAuto, /// The computed `left`, a `Length` in px or `Auto`. /// /// Needed: the specification text says "'left'". pub left: LengthPercentageOrAuto, /// The computed `width`, a `Length` in px or `Auto`. An intrinsic-sizing keyword, and /// `width: auto` with `left` or `right` `auto`, arrive as the `Length` the shrink-to-fit /// width gives. A `Length` measures the box `box-sizing` names. /// /// Needed: the specification text says "'width'". pub width: LengthPercentageOrAuto, /// The computed `height`, a `Length` in px or `Auto`. On the second call for a box whose /// `height` is an intrinsic-sizing keyword it is the content height as a `Length`. A /// `Length` measures the box `box-sizing` names. /// /// Needed: the specification text says "'height'". pub height: LengthPercentageOrAuto, /// The computed `margin-left`, a `Length` in px or `Auto`. /// /// Needed: the specification text says "'margin-left'". pub margin_left: LengthPercentageOrAuto, /// The computed `margin-right`, a `Length` in px or `Auto`. /// /// Needed: the specification text says "'margin-right'". pub margin_right: LengthPercentageOrAuto, /// The computed `margin-top`, a `Length` in px or `Auto`. /// /// Needed: the specification text says "'margin-top'". pub margin_top: LengthPercentageOrAuto, /// The computed `margin-bottom`, a `Length` in px or `Auto`. /// /// Needed: the specification text says "'margin-bottom'". pub margin_bottom: LengthPercentageOrAuto, /// The used left padding, in px. pub padding_left: f64, /// The used right padding, in px. pub padding_right: f64, /// The used top padding, in px. pub padding_top: f64, /// The used bottom padding, in px. pub padding_bottom: f64, /// The used left border width, in px. pub border_left: f64, /// The used right border width, in px. pub border_right: f64, /// The used top border width, in px. pub border_top: f64, /// The used bottom border width, in px. pub border_bottom: f64, /// Whether the computed `box-sizing` is `border-box` rather than `content-box`. /// /// Needed: the specification text says "box-sizing". pub border_box_sizing: bool, /// The box's own `direction`, which decides the offset discarded when `left`, `width` /// and `right` over-constrain the equation (`Ltr` discards `right`, `Rtl` discards /// `left`). /// /// Needed: the specification text says "'direction'". pub direction: Direction, /// The box's used content height, in px, once its children are laid out: `Some` on the /// second call for a box, `None` on the first. A box whose `height` is `auto` takes it /// as its height (CSS 2.1 10.6.4). /// /// Needed: the specification text says "content height". pub content_height: Option<f64>,}
/// 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 AbsoluteEngineAnswer { /// The used offset, in px, from the containing block's padding-box left edge to the /// box's left margin edge. The engine adds `margin_left` on top. pub left: f64, /// The used offset, in px, from the containing block's padding-box top edge to the /// box's top margin edge. The engine adds `margin_top` on top. pub top: f64, /// The used content-box width, in px. pub used_width: f64, /// The used content-box height, in px. pub used_height: f64, /// The used left margin, in px. pub margin_left: f64, /// The used right margin, in px. pub margin_right: f64, /// The used top margin, in px. pub margin_top: f64, /// The used bottom margin, in px. pub margin_bottom: f64,}