pub(crate) enum Size<T> {
Initial,
MinContent,
MaxContent,
FitContent,
FitContentFunction(T),
Stretch,
Numeric(T),
}
Expand description
The possible values accepted by the sizing properties. https://drafts.csswg.org/css-sizing/#sizing-properties
Variants§
Initial
Represents an auto
value for the preferred and minimum size properties,
or none
for the maximum size properties.
https://drafts.csswg.org/css-sizing/#valdef-width-auto
https://drafts.csswg.org/css-sizing/#valdef-max-width-none
MinContent
MaxContent
FitContent
FitContentFunction(T)
Stretch
Numeric(T)
Represents a numeric <length-percentage>
, but resolved as a T
.
https://drafts.csswg.org/css-sizing/#valdef-width-length-percentage-0
Implementations§
Source§impl Size<LengthPercentage>
impl Size<LengthPercentage>
pub(crate) fn to_percentage(&self) -> Option<Percentage>
Sourcepub(crate) fn resolve_percentages_for_preferred(
&self,
basis: Option<Au>,
) -> Size<Au>
pub(crate) fn resolve_percentages_for_preferred( &self, basis: Option<Au>, ) -> Size<Au>
Resolves percentages in a preferred size, against the provided basis. If the basis is missing, percentages are considered cyclic. https://www.w3.org/TR/css-sizing-3/#preferred-size-properties https://www.w3.org/TR/css-sizing-3/#cyclic-percentage-size
Sourcepub(crate) fn resolve_percentages_for_max(&self, basis: Option<Au>) -> Size<Au>
pub(crate) fn resolve_percentages_for_max(&self, basis: Option<Au>) -> Size<Au>
Resolves percentages in a maximum size, against the provided basis. If the basis is missing, percentages are considered cyclic. https://www.w3.org/TR/css-sizing-3/#preferred-size-properties https://www.w3.org/TR/css-sizing-3/#cyclic-percentage-size
Source§impl Size<Au>
impl Size<Au>
Sourcepub(crate) fn resolve_for_preferred<F: FnOnce() -> ContentSizes>(
&self,
automatic_size: Size<Au>,
stretch_size: Option<Au>,
content_size: &LazyCell<ContentSizes, F>,
) -> Au
pub(crate) fn resolve_for_preferred<F: FnOnce() -> ContentSizes>( &self, automatic_size: Size<Au>, stretch_size: Option<Au>, content_size: &LazyCell<ContentSizes, F>, ) -> Au
Resolves a preferred size into a numerical value. https://www.w3.org/TR/css-sizing-3/#preferred-size-properties
Sourcepub(crate) fn resolve_for_min<F: FnOnce() -> ContentSizes>(
&self,
get_automatic_minimum_size: impl FnOnce() -> Au,
stretch_size: Option<Au>,
content_size: &LazyCell<ContentSizes, F>,
is_table: bool,
) -> Au
pub(crate) fn resolve_for_min<F: FnOnce() -> ContentSizes>( &self, get_automatic_minimum_size: impl FnOnce() -> Au, stretch_size: Option<Au>, content_size: &LazyCell<ContentSizes, F>, is_table: bool, ) -> Au
Resolves a minimum size into a numerical value. https://www.w3.org/TR/css-sizing-3/#min-size-properties
Sourcepub(crate) fn resolve_for_max<F: FnOnce() -> ContentSizes>(
&self,
stretch_size: Option<Au>,
content_size: &LazyCell<ContentSizes, F>,
) -> Option<Au>
pub(crate) fn resolve_for_max<F: FnOnce() -> ContentSizes>( &self, stretch_size: Option<Au>, content_size: &LazyCell<ContentSizes, F>, ) -> Option<Au>
Resolves a maximum size into a numerical value. https://www.w3.org/TR/css-sizing-3/#max-size-properties
Sourcepub(crate) fn maybe_resolve_extrinsic(
&self,
stretch_size: Option<Au>,
) -> Option<Au>
pub(crate) fn maybe_resolve_extrinsic( &self, stretch_size: Option<Au>, ) -> Option<Au>
Tries to resolve an extrinsic size into a numerical value. Extrinsic sizes are those based on the context of an element, without regard for its contents. https://drafts.csswg.org/css-sizing-3/#extrinsic
Returns None
if either:
- The size is intrinsic.
- The size is the initial one.
TODO: should we allow it to behave as
stretch
instead of assuming it’s intrinsic? - The provided
stretch_size
isNone
but we need its value.
Trait Implementations§
Source§impl From<GenericMaxSize<NonNegative<LengthPercentage>>> for Size<LengthPercentage>
impl From<GenericMaxSize<NonNegative<LengthPercentage>>> for Size<LengthPercentage>
Source§fn from(max_size: StyleMaxSize) -> Self
fn from(max_size: StyleMaxSize) -> Self
Source§impl From<GenericSize<NonNegative<LengthPercentage>>> for Size<LengthPercentage>
impl From<GenericSize<NonNegative<LengthPercentage>>> for Size<LengthPercentage>
impl<T: Copy> Copy for Size<T>
impl<T> StructuralPartialEq for Size<T>
Auto Trait Implementations§
impl<T> Freeze for Size<T>where
T: Freeze,
impl<T> RefUnwindSafe for Size<T>where
T: RefUnwindSafe,
impl<T> Send for Size<T>where
T: Send,
impl<T> Sync for Size<T>where
T: Sync,
impl<T> Unpin for Size<T>where
T: Unpin,
impl<T> UnwindSafe for Size<T>where
T: UnwindSafe,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.