struct FlexItem<'a> {Show 15 fields
box_: &'a FlexItemBox,
content_cross_sizes: Sizes,
padding: FlexRelativeSides<Au>,
border: FlexRelativeSides<Au>,
margin: FlexRelativeSides<AuOrAuto>,
pbm_auto_is_zero: FlexRelativeVec2<Au>,
flex_base_size: Au,
flex_base_size_is_definite: bool,
hypothetical_main_size: Au,
content_min_main_size: Au,
content_max_main_size: Option<Au>,
align_self: T,
depends_on_block_constraints: bool,
preferred_aspect_ratio: Option<AspectRatio>,
cross_size_stretches_to_line: bool,
}
Expand description
A flex item with some intermediate results
Fields§
§box_: &'a FlexItemBox
§content_cross_sizes: Sizes
The preferred, min and max inner cross sizes. If the flex container is single-line
and Self::cross_size_stretches_to_line
is true, then the preferred cross size
is set to Size::Stretch
.
padding: FlexRelativeSides<Au>
§border: FlexRelativeSides<Au>
§margin: FlexRelativeSides<AuOrAuto>
§pbm_auto_is_zero: FlexRelativeVec2<Au>
Sum of padding, border, and margin (with auto
assumed to be zero) in each axis.
This is the difference between an outer and inner size.
flex_base_size: Au
§flex_base_size_is_definite: bool
Whether the Self::flex_base_size
comes from a definite flex-basis
.
If false and the container main size is also indefinite, percentages in the item’s
content that resolve against its main size should be indefinite.
hypothetical_main_size: Au
§content_min_main_size: Au
The used min main size of the flex item. https://drafts.csswg.org/css-flexbox/#min-main-size-property
content_max_main_size: Option<Au>
The used max main size of the flex item. https://drafts.csswg.org/css-flexbox/#max-main-size-property
align_self: T
This is align-self
, defaulting to align-items
if auto
depends_on_block_constraints: bool
Whether or not the size of this FlexItem
depends on its block constraints.
preferred_aspect_ratio: Option<AspectRatio>
§cross_size_stretches_to_line: bool
Whether the preferred cross size of the item stretches to fill the flex line.
This happens when the size computes to auto
, the used value of align-self
is stretch
, and neither of the cross-axis margins are auto
.
https://drafts.csswg.org/css-flexbox-1/#stretched
Note the following sizes are not sufficient:
- A size that only behaves as
auto
(like a cyclic percentage). The computed value needs to beauto
too. - A
stretch
size. It stretches to the containing block, not to the line (under discussion in https://github.com/w3c/csswg-drafts/issues/11784).
Implementations§
Source§impl<'a> FlexItem<'a>
impl<'a> FlexItem<'a>
fn new(flex_context: &FlexContext<'_>, box_: &'a FlexItemBox) -> Self
Source§impl FlexItem<'_>
impl FlexItem<'_>
Sourcefn layout(
&self,
used_main_size: Au,
flex_context: &FlexContext<'_>,
used_cross_size_override: Option<Au>,
non_stretch_layout_result: Option<&mut FlexItemLayoutResult>,
) -> Option<FlexItemLayoutResult>
fn layout( &self, used_main_size: Au, flex_context: &FlexContext<'_>, used_cross_size_override: Option<Au>, non_stretch_layout_result: Option<&mut FlexItemLayoutResult>, ) -> Option<FlexItemLayoutResult>
Return the hypothetical cross size together with laid out contents of the fragment. From https://drafts.csswg.org/css-flexbox/#algo-cross-item:
performing layout as if it were an in-flow block-level box with the used main size and the given available space, treating
auto
asfit-content
.
fn synthesized_baseline_relative_to_margin_box(&self, content_size: Au) -> Au
Sourcefn resolve_auto_margins(
&self,
flex_context: &FlexContext<'_>,
line_cross_size: Au,
item_cross_content_size: Au,
space_distributed_to_auto_main_margins: Au,
) -> FlexRelativeSides<Au>
fn resolve_auto_margins( &self, flex_context: &FlexContext<'_>, line_cross_size: Au, item_cross_content_size: Au, space_distributed_to_auto_main_margins: Au, ) -> FlexRelativeSides<Au>
Return the cross-start, cross-end, main-start, and main-end margins, with auto
values resolved.
See:
Sourcefn align_along_cross_axis(
&self,
margin: &FlexRelativeSides<Au>,
used_cross_size: &Au,
line_cross_size: Au,
propagated_baseline: Au,
max_propagated_baseline: Au,
wrap_reverse: bool,
) -> Au
fn align_along_cross_axis( &self, margin: &FlexRelativeSides<Au>, used_cross_size: &Au, line_cross_size: Au, propagated_baseline: Au, max_propagated_baseline: Au, wrap_reverse: bool, ) -> Au
Return the coordinate of the cross-start side of the content area
fn is_table(&self) -> bool
Auto Trait Implementations§
impl<'a> Freeze for FlexItem<'a>
impl<'a> !RefUnwindSafe for FlexItem<'a>
impl<'a> Send for FlexItem<'a>
impl<'a> Sync for FlexItem<'a>
impl<'a> Unpin for FlexItem<'a>
impl<'a> !UnwindSafe for FlexItem<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more