Struct taffy::compute::grid::track_sizing::IntrisicSizeMeasurer
source · struct IntrisicSizeMeasurer<'tree, 'oat, Tree, EstimateFunction>{
tree: &'tree mut Tree,
other_axis_tracks: &'oat [GridTrack],
get_track_size_estimate: EstimateFunction,
axis: AbstractAxis,
inner_node_size: Size<Option<f32>>,
}
Expand description
This struct captures a bunch of variables which are used to compute the intrinsic sizes of children so that those variables don’t have to be passed around all over the place below. It then has methods that implement the intrinsic sizing computations
Fields§
§tree: &'tree mut Tree
The layout tree
other_axis_tracks: &'oat [GridTrack]
The tracks in the opposite axis to the one we are currently sizing
get_track_size_estimate: EstimateFunction
A function that computes an estimate of an other-axis track’s size which is passed to the child size measurement functions
axis: AbstractAxis
The axis we are currently sizing
inner_node_size: Size<Option<f32>>
The available grid space
Implementations§
source§impl<Tree, EstimateFunction> IntrisicSizeMeasurer<'_, '_, Tree, EstimateFunction>
impl<Tree, EstimateFunction> IntrisicSizeMeasurer<'_, '_, Tree, EstimateFunction>
sourcefn available_space(&self, item: &mut GridItem) -> Size<Option<f32>>
fn available_space(&self, item: &mut GridItem) -> Size<Option<f32>>
Compute the available_space to be passed to the child sizing functions These are estimates based on either the max track sizing function or the provisional base size in the opposite axis to the one currently being sized. https://www.w3.org/TR/css-grid-1/#algo-overview
sourcefn margins_axis_sums_with_baseline_shims(&self, item: &GridItem) -> Size<f32>
fn margins_axis_sums_with_baseline_shims(&self, item: &GridItem) -> Size<f32>
Compute the item’s resolved margins for size contributions. Horizontal percentage margins always resolve to zero if the container size is indefinite as otherwise this would introduce a cyclic dependency.
sourcefn min_content_contribution(&mut self, item: &mut GridItem) -> f32
fn min_content_contribution(&mut self, item: &mut GridItem) -> f32
Retrieve the item’s min content contribution from the cache or compute it using the provided parameters
sourcefn max_content_contribution(&mut self, item: &mut GridItem) -> f32
fn max_content_contribution(&mut self, item: &mut GridItem) -> f32
Retrieve the item’s max content contribution from the cache or compute it using the provided parameters
sourcefn minimum_contribution(
&mut self,
item: &mut GridItem,
axis_tracks: &[GridTrack],
) -> f32
fn minimum_contribution( &mut self, item: &mut GridItem, axis_tracks: &[GridTrack], ) -> f32
The minimum contribution of an item is the smallest outer size it can have. Specifically:
- If the item’s computed preferred size behaves as auto or depends on the size of its containing block in the relevant axis: Its minimum contribution is the outer size that would result from assuming the item’s used minimum size as its preferred size;
- Else the item’s minimum contribution is its min-content contribution.
Because the minimum contribution often depends on the size of the item’s content, it is considered a type of intrinsic size contribution.