Struct taffy::compute::grid::track_sizing::IntrisicSizeMeasurer

source ·
struct IntrisicSizeMeasurer<'tree, 'oat, Tree, EstimateFunction>
where Tree: LayoutPartialTree, EstimateFunction: Fn(&GridTrack, Option<f32>) -> Option<f32>,
{ 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>
where Tree: LayoutPartialTree, EstimateFunction: Fn(&GridTrack, Option<f32>) -> Option<f32>,

source

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

source

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.

source

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

source

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

source

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.

Auto Trait Implementations§

§

impl<'tree, 'oat, Tree, EstimateFunction> Freeze for IntrisicSizeMeasurer<'tree, 'oat, Tree, EstimateFunction>
where EstimateFunction: Freeze,

§

impl<'tree, 'oat, Tree, EstimateFunction> RefUnwindSafe for IntrisicSizeMeasurer<'tree, 'oat, Tree, EstimateFunction>
where EstimateFunction: RefUnwindSafe, Tree: RefUnwindSafe,

§

impl<'tree, 'oat, Tree, EstimateFunction> Send for IntrisicSizeMeasurer<'tree, 'oat, Tree, EstimateFunction>
where EstimateFunction: Send, Tree: Send,

§

impl<'tree, 'oat, Tree, EstimateFunction> Sync for IntrisicSizeMeasurer<'tree, 'oat, Tree, EstimateFunction>
where EstimateFunction: Sync, Tree: Sync,

§

impl<'tree, 'oat, Tree, EstimateFunction> Unpin for IntrisicSizeMeasurer<'tree, 'oat, Tree, EstimateFunction>
where EstimateFunction: Unpin,

§

impl<'tree, 'oat, Tree, EstimateFunction> !UnwindSafe for IntrisicSizeMeasurer<'tree, 'oat, Tree, EstimateFunction>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.